summaryrefslogtreecommitdiff
path: root/src/com/android/mail/ui/SwipeableListView.java
Commit message (Collapse)AuthorAgeFilesLines
* unified-email: respect swipe user settingJorge Ruesga2016-12-301-3/+4
| | | | | | | Don't start swipe if the user has disabled it by settings Change-Id: I79b2d694219dc6497fbe85d7608bd36ee48a42d7 Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
* Save the focused conversation via id instead of positionJin Cao2014-10-171-8/+44
| | | | | | | | | | | | | | | Don't rely on saving the position in the adapter because the position might change as the adapter's data set changes (e.g. new mails via sync), and we have no way of modifying the focused position accordingly. Instead, save the focused conversation with its id (tried using the uri, but the uri might change when the conversation gets cached). This way, no matter what happens to the items in the adapter, the focused item remains consistent. b/18027602 Change-Id: I51aa68bc15c5892c3b34bde5c199de281390ce7b
* Programmatically set selected state to correspond to peeking convJin Cao2014-10-161-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I can't simply rely on ListView#setSelection to programmatically set the selected item because setSelection only caches the selection internally if the view is currently in touch mode. Thus, in touch modes, isSelected() will *always* return false for an item in listview. In order to know what's the current selected item, I keep track of the selected position that corresponds EXACTLY to the listview's selected position. Again, I can't use ListView#getSelectedItemPosition because it will always return INVALID_POSITION in touch mode. I change the selected position whenever a child calls setSelected() or we programmatically call setSelected. I tried using onItemSelectedListener. However, the listener's callback is called after the selected state is changed AND the re-draw happened, so the UI gets inconsistent since the selected state didn't properly update during the re-draw. When we programmatically select an item that's visible on the screen, we have to use ListView#setSelectionFromTop and pass in the current y value since the default behavior is to scroll such that the selected item is at the very top. Also, another caveat is that I am now saving the ConversationItemView's position in the adapter when the adapter binds data to it. I find that this approach is much more dependable than using ListView#getPositionForView because sometimes (for reasons beyond me) in ConversationItemView#setSelected the listview ONLY HAS ONE CHILD (even though on the device I can see a full list), thus getPositionForView will return index 0 since it thinks it's the only child.. I have no clue, so I'm saving the position myself instead. b/18015875 Change-Id: I11897056fc9fa630eb4019532b1fd4cf41c7486a
* Update shadows for TL (Quantum) UnifiedEmailRohan Shah2014-09-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | NOTE: I'll fix FAB issues in a different CL Add shadows assets on L & pre-L (RTL included) for thread list sides. To avoid overdraw, the backgrounds have been modified (The outermost framelayout for TL now has a white background instead of each of the conversation items). For both L & pre-L, we're using two shadow assets on either side of the TL, both of which are set as backgrounds for the drawer and the conversation view (conv pane). Elevation didn't work out too well and will be revisited while fixing overdraw issues (Need to move around swipe/leave-behind item backgrounds and it seems a bit risky to mess with it given the timeline) + Also removed the background on the loading item under conversations in the TL and used the default conversation item background to get rid of the ugly divider/slight line flicker on folder change Bug: 17461682 Change-Id: Id9e4504b6063f21a055ed492fc8de962e6e52462
* Remove unnecessary calls to setCheckedItemJin Cao2014-09-091-8/+0
| | | | | | | | | | We have multiple places where we call setCheckedItem, and it seems that there can be discrepancy among what indices are checked, so we get weird behavior when we are in CAB mode. b/17441959 Change-Id: Ia5ad6f17288b76b5fe4b5a4d64ef856f77c13616
* Keyboard support for focused stateJin Cao2014-09-021-11/+11
| | | | | | | | | | | | | | - remove focusable from FAB so keyboard won't navigate to it. - rename selectionSet to checkedSet - selected is a state for listview to focus one of its elements - what we really want is checked state for checked items in CAB mode. - show the blue focus bar when isSelected returns true - this is auto-set by the framework as we navigate using the keyboard. - remove blue background color for selected state b/17258708 Change-Id: Ic9739c9b349403942f64fafa26500c08d1f1cc4c
* prevent list swipes when 2-pane drawer is openAndy Huang2014-08-211-3/+26
| | | | | Bug: 17070336 Change-Id: Ie33ae772053dfe9b0f592a6ce3f42f2d5f018dbe
* Support "deleting" in outboxJin Cao2014-08-011-0/+2
| | | | | | | | | | | | | - Allow only failed items in Outbox to be swiped away/deleted. - Same applies for multi-selection. - "Deleting" in Outbox means remove the outbox label from the failed message and applying the drafts label. This needs to be implemented by both Gmail and Email providers. - Added new ConversationOperation for this new action. b/4080109 Change-Id: Ia9c8e386c7c65693f72fda85a49cb6a1b7d1fec1
* Ditch HeaderViewListAdapter and support headersJin Cao2014-08-011-3/+0
| | | | | | | | | | Support arbitrary number of headers in AnimatedAdapter instead of relying on ListView#addHeaderView and HeaderViewListAdapter. b/16728934 Change-Id: I1e4d02ac8b6557411ab47895002088d798ff2fc2
* [Quantum search] update search headerJin Cao2014-07-291-0/+4
| | | | | | | | | Add search header to be part of list so it scrolls properly. Updated corresponding styles. b/16518233 Change-Id: I795ea687795c2f3d96dc241eca2a9044957a9936
* Remove attachment previews from Conversation ListJames Lemieux2014-07-111-41/+0
| | | | | | | | | | | | | | | This includes: - all references to the 3 attachment preview columns in the Gmail conversation table (except for migration code in MailStoreInitializer) - all layout and drawing code for attachment previews in conversation list - all assets related to attachment previews - all preference and analytics code that aided attachment previews NOTE: This does not alter, in any way, the display of attachments in conversation view. Change-Id: I0aa5a32c8cce0ba98758827b973b323896932c39
* Refactored undismissable swipesJin Cao2014-03-281-7/+3
| | | | | | | | | | | | | In this change I refactored out the placeholder no-op id introduced previously and instead default the "bounce back no-op" behavior for all swipe gestures that occurred on conversation items that are not dismissable (due to either folder settings or user settings). This should make the user experience more consistent. b/13681416 b/9825846 // original issue Change-Id: Ibeee419314e22b552a0b6dec4d4adbc8e17d38bf
* Change default swipe actionJin Cao2014-03-261-1/+1
| | | | | | | | | | | For folders where archive is not feasible (e.g. All Mail), we are changing the default action to be a no-op (bounce the item back) instead of deleting it since it can be confusing for users. For delete, it still deletes everything regardless. b/9825846 Change-Id: Id56d2327db3b2bc48f94a8afb3ca32c95b56c4ef
* Disable swipe refresh when swiping to archive.Andrew Sapperstein2014-02-101-7/+15
| | | | | | Fixes b/12570813. Change-Id: Ifa5f427f83e038ed3f5402c85e9416a1512ee691
* Use Drawables for senders image. Less animation jank, less GC jank, less memory.Mark Wei2013-09-131-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | Protip: When testing sender images, go to your Sent folder. Tons of senders images appear because you are most likely to talk to people in your address book. Rewrite UI to use modular Drawables. It's much easier to understand, since Drawables with different functionality can be composed. Flipping animation is 10x smoother. Handles quick double-tap on senders image correctly. Letter tiles are not allocated bitmaps anymore. They simply draw a rect and a letter to the canvas. We are no longer allocating large bitmaps for every list item. We reuse Bitmaps whenever possible the same way that attachment previews do. Much smaller 339KB cache since we don't share with attachment previews anymore, just enough to fit 10 off-screen contact images. Bug: 10429228 Change-Id: I463b63520d881eefe3974dccf295366831adaf9e
* move ad analytics to gmailAndy Huang2013-08-141-2/+1
| | | | | Bug: 9861033 Change-Id: I30bbf5ea7b9e2a2a03588263be1afc9909e16729
* more metricsAndy Huang2013-08-141-0/+6
| | | | | | | | | | | Reorg category/action/label to be more economical. This gives us an extra slot for data vs. spending on custom dimensions in the future. Log CAB actions, some settings state, drawer toggles, CAB mode start, swipe dismiss, and peek. Bug: 9861033 Change-Id: I16b30356db70f60ed87749f29ddd667790acbb07
* Add a setting for attachment previews.Mark Wei2013-08-071-9/+0
| | | | | Bug: 10131520 Change-Id: I861a3aa7a1131c1a089011aed7492a0e4ff1ebcc
* Merge "Fix nit 5. Do not decode in background thread if cache is not warm." ↵Mark Wei2013-08-021-0/+4
|\ | | | | | | into jb-ub-mail-ur10
| * Fix nit 5. Do not decode in background thread if cache is not warm.Mark Wei2013-08-021-0/+4
| | | | | | | | | | | | | | | | | | | | | | When the ReusableBitmap pool is initially empty, all decodes must construct new ReusableBitmap objects, which often causes GCs that cause jank during scroll. This prevents the jank by notifying the ReusableBitmap pool that a scroll is in progress, which causes the pool to block on poll() if no ReusableBitmaps can be returned. Bug: 10083052 Change-Id: Iaf8b244617a05d4736df041e888c9140d182c3a3
* | Change default parallax speed to be slower.Mark Wei2013-08-021-2/+2
|/ | | | | | 1.5 multiplier is what we used before and it seems to work well with testers. Change-Id: Ie69e877c865a45dceb16409f876a12a4b842b0d4
* Fix nit 9. Add setting to change parallax speed and direction.Mark Wei2013-08-011-2/+11
| | | | | | | | | | Change default speed to 2.0 multiplier. Change default direction to normal (new) parallax. This looks like you are looking through a window, at the attachment previews which exist in another pane. Bug: 10083052 Change-Id: I91f91ae57cda2da22cc5e3330f67982df454e7bc
* Fix attachment nit 4.Mark Wei2013-08-011-0/+7
| | | | | | | | Add ContiguousFIFOAggregator to aggregate decode results and display them in the correct order. Bug: 10083052 Change-Id: I28b00fe44818f7882e44ef222d85d58ce111c7fe
* Change all resid switches to if-elseif-elseScott Kennedy2013-07-311-23/+19
| | | | | | | | | | | | | | | | | I really want to get this building in an IDE. As per http://tools.android.com/tips/non-constant-fields, library projects (like UnifiedEmail will be) have non-final R constants. They are not final until packaged into the main application project's (Gmail/Email)'s R.java. As such, they cannot be used in switch case statements, and we must use if-elseif-elseif-elseif-...-else instead. "This is typically in UI code and the performance impact is negligible." Change-Id: Ie699c13e1becd51c59c1b2ea81bc902d4f2e28d9
* new allocation-minimizing bitmap decoderAndy Huang2013-07-291-1/+23
| | | | | | | | | | | | | | | | | | Use a new image decoding and caching framework. This one maximizes bitmap reuse by decoding into fixed-sized Bitmaps and relying on BitmapRegionDecoder to only decode a desired region. The ultimate goal is to allocate memory less often, as each large allocation triggers GC jank. The overall request/response abstraction and threading model are now cleaner, and caching is no longer a required fixture. Multi-core decoding is now supported, with a currently fixed thread pool size of 4. Attachment images are the only client for now, but contact photos will switch to this framework next. Bug: 9566006 Change-Id: I7c437941fd984cc0038da8f0ffd1df1a9ced4dd3
* Better CAB modeScott Kennedy2013-07-231-4/+2
| | | | | | | | | | 1. Flip out contact image, scale in a checkbox optionally on grey background 2. Flip stars into peek icons 3. Only peek icon will peek Bug: 9592097 Change-Id: Ia972132284ef62f4964c7027ab09157a525dd804
* Add fade animations.Mark Wei2013-07-161-1/+1
| | | | | | | | | | Fix exceptions. New layout for previews. Bug: 9745486 Bug: 9860384 Bug: 9885937 Change-Id: Ief210b211e87898c6516d867b59d76c72a765596
* Add a new FolderUriScott Kennedy2013-07-161-2/+2
| | | | | | | | This will allow us to add query parameters such that Uris will still appear to be equal, regardless of differences in the parameters. Bug: 9780067 Change-Id: Iafe39763b3ee448cf02536df89caa736500dfdaf
* Final UI for Attachment Previews.Mark Wei2013-07-121-2/+2
| | | | | | | | | | | | | Placeholder pulsates for images not yet loaded. One images loads at a time, that one image will display a spinning progressbar after a delay. Progress bar fixes to ensure it is rotates smoothly. Clear section before drawing to it so transparent images look right. Avoid PhotoManager load loop. Bug: 9745486 Bug: 9816053 Change-Id: I2e65b3e3484d6da47d4e2523404dc745b99dd04c
* Attachments in Conversation List: Backend changes so that the appropriateMark Wei2013-07-081-10/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | attachments are passed to the UI. Implement PhotoManager so we can start showing images. Upon sync, we extract two image attachments from the first unread message, and add them to the conversations table. UI changes as well. Load BEST if that is available, else load SIMPLE. No vertical dividers in attachment previews. Attachment previews are above labels. Round badge appears for unread conversations when there are more images than shown. Only appears after the previews have loaded. Clicking on the attachment previews launches photoviewer. Attempt to load bigger images than necessary to prevent reloading during mark read/unread and rotate. Show animated loading icon while previews are loading. Previews load from top to bottom, from left to right. Big performance improvements: No longer decoding bitmap on UI thread. This kills most of the jank. Only load when we are not scrolling. This kills a lot of jank. Remaining jank will be delt with later: DividedImageCanvas.setDimensions() creates a huge empty bitmap on the UI thread, which causes a GC. ath will fix. Multiple images in one line now load whatever's ready first. Added tracing. Bitmap cache given more memory. Following ath's advice, decode Bitmap from InputStream rather than byte[]. Don't compress into BitmapHolder. Only use the bigger Bitmap cache. Bug: 7481049 Change-Id: Icf823f56abc9345e6d0b800a1e6d45444d8fa028
* Don't let ConversationCursor do work during scrollAndy Huang2013-06-201-0/+13
| | | | | Bug: 9032162 Change-Id: Id47fd9c2a1cab01b798a0c24a5802a3d059d5c70
* am 599e7f8b: fix occasionally opening the wrong conversationAndy Huang2013-06-141-2/+2
|\ | | | | | | | | * commit '599e7f8bf95d2f21a966cbff1bf72adf77a90a33': fix occasionally opening the wrong conversation
| * fix occasionally opening the wrong conversationAndy Huang2013-06-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | The 'alternate strategy' for finding the cursor position of the ConversationItemView you clicked on wasn't taking into account the list scroll position. TBD: why do we even get into this case? Bug: 9430513 Change-Id: I3780ca563307a4347b1c6ad666b42dc1dc934659
* | Fix the folder click problemVikram Aggarwal2013-06-071-5/+5
|/ | | | | | | | | | The SwipeHandler should never act on NestedFolderView elements since these should not be allowed to swipe. Fixes the issue where the folders were not clickable. Also, remove a lot of unused code in the SwipeHelper. Change-Id: I4495a4224e28d52560ead47ee9e3f6d34c4ab916
* am 6126d72a: Fix multi-selection on tablets. We invalidated our previous ↵Mark Wei2013-04-261-1/+20
|\ | | | | | | | | | | | | assumption that tablets will always have a checkbox. This fixes new issues with tablet CAB mode. * commit '6126d72ae2769bd39451872f45781cadb5b90515': Fix multi-selection on tablets. We invalidated our previous assumption that tablets will always have a checkbox. This fixes new issues with tablet CAB mode.
| * Fix multi-selection on tablets.Mark Wei2013-04-261-1/+20
| | | | | | | | | | | | | | | | We invalidated our previous assumption that tablets will always have a checkbox. This fixes new issues with tablet CAB mode. Bug: 8698135 Change-Id: If76f0f3d07f1b515afc5d05f57f0d8cc068b3fe9
* | Clean up selected setVikram Aggarwal2013-04-161-1/+1
|/ | | | | | | | | | | Toggling values in the selected set needed ConversationItemViews which were passed as null under controlled circumstances. It is much cleaner to pass Conversation objects, as all the relevant information is contained there. Removing the view from the toggle() call. No change in functionality. Change-Id: I88f5a91c721ff673ae5b6efd251ebd034a8d5ffa
* Merge "Disable pull to refresh during a swipe" into jb-mr2-devAlice Yang2013-04-121-0/+17
|\
| * Disable pull to refresh during a swipeAlice Yang2013-04-111-0/+17
| | | | | | | | | | | | | | | | | | Also removed the velocity trigger and only use distance traveled to trigger pull to refresh. Bug 8572410 Change-Id: Ia8c04e97aaf4ec42e96cb42996d94403539e7162
* | fix shorter-than-expected leave-behind view heightsAndy Huang2013-04-111-16/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make leave-behind heights variable, dependent on the ConversationItemView that originated it. Make the background on a SwipeableCIV not a separate view, but a simple background. Also simplify the conditions under which it occurs-- it just appears whenever translateX is non-zero. This covers all swiping and animating cases handily, without the need for extra listeners. Remove an old workaround that gave ListView on 1-pane an opaque background- - it was there to mask FolderListFragments that stuck around, but those are relegated to the drawer now. This reduces list overdraw by one. Bug: 8570880 Change-Id: I2e2ea875d4ab58b5048d41025b8a2c48a3d63536
* | Always open the thread we clickScott Kennedy2013-04-101-4/+2
|/ | | | | | | | Conversation.position is not something we should be using. It can be wrong, and it's difficult to keep in sync with what we want. Bug: 8441077 Change-Id: I34d4c2568ec38dca62505bd629dbccdfb5b06b5c
* Dead vertical left, to disallow accidental swipes.Vikram Aggarwal2013-03-221-4/+2
| | | | | | | | A vertical block of pixes on the left edge of the screen should not accidentally swipe the conversation since swipe is destructive. Bug: 8434484 The new gmail UI makes my experience more difficult Change-Id: Ic135600eed75c435dcc131ee544492f23365e3ea
* Clean up a bunch of warningsScott Kennedy2013-03-211-6/+5
| | | | Change-Id: I5c75564eeb2df9ec76d682dbe5f4465ff2a1a5d4
* Change the undo message for a "Move to" actionScott Kennedy2013-03-151-1/+2
| | | | | | | | | | Previously, the undo bar toast could only show the currently displayed folder, but we want to be able to say something like "Moved to Social". So now, we can pass in any folder that we consider the recipient of the action, and this is the folder name that gets displayed in the toast. Change-Id: I0b17462be86657f7d0c9a3504d15091a157a2292
* Speculative fix for dropped archivesPaul Westbrook2013-02-041-3/+5
| | | | | | | If the list view isn't able to destry the item, perform the action manually Change-Id: I07ae2cd28cdc38033b3e6d6697746a0f3b9c13f9
* Updates to swipe interactionmindyp2013-01-161-1/+1
| | | | | | | | | When swiping away items, wait to fade in action text such as "archive | undo" until: 1) all items that are being collapsed have collapsed 2) we are no longer waiting for the user to try to start swiping another item Change-Id: Iaec75fb6a3a144e8b4c469f6e48f4354ec4aff8d
* Fade out other leave behind when user starts new swipemindyp2013-01-161-0/+10
| | | | | | | | Change-Id: Icdd1b7d65715852d5fd976e7fccaf5790f940892 Conflicts: src/com/android/mail/ui/SwipeHelper.java
* swipe tweaksmindyp2012-12-191-0/+13
| | | | Change-Id: I5011f11989056376be748161fdb3f0e699366454
* Update folder changes from UPDATE_FOLDER_COLUMN to FOLDERS_UPDATEDmindyp2012-12-111-2/+8
| | | | | | fixes b/7710067 clean up leftover cases of folder updates that aren't yet using folder diffing (FOLDERS_UPDATED) Change-Id: I145c7ba39ea705772fdb7a47990d3ff7831401cc
* Convert rawFolders from String to FolderListAndy Huang2012-12-101-3/+8
| | | | | | | | | | | | | | | | | | Continuing in the Parcel > String vein, switch rawFolders to use FolderList, a small immutable Parcelable class. Individual Folder objects are still stringified when used alone, but those are not time-sensitive cases (e.g. generating a view intent). Traceview on Nexus 7 shows 61% speedup in serializing and deserializing folder rawFolders. Overall time for Conversation construction appears to go up, but that's because the previously lazy-deserialization is now done in the constructor. I think this is okay, since the only performance-sensitive codepath that constructs Conversation objects is the conversation list, which always needs rawFolders. Bug: 7690709 Change-Id: I42eadd79aaeb260f3d9642bf930437a69e510282