Commit Graph

37 Commits

Author SHA1 Message Date
Brandon Dayauon
47000ae6e6 Fix big icon when dragging Toast by isolating the previous QL fix display to SEARCH_RESULT_APP_ROW
- Create another icon, "all_apps_predicted_row_icon" that will be the mDisplay for the predicted app row
in AllAppsList

Bug:299171695
Test: video
Before: https://drive.google.com/file/d/1HxNW0015nQHCc7eQiySf-gwsHrLs_JjR/view?usp=sharing
after: https://drive.google.com/file/d/1HyEwKI-yumILTCjglKcqovhTlRVjNGxg/view?usp=sharing - making sure that QL is fine and dragging regular Toast results are normal
Flag: N/a
Change-Id: Ie002cacb168396dbea39f79679bd6a04b80e374b
2023-09-20 14:21:10 -07:00
Sebastian Franco
3f6bc94b3f If the view for the drag preview is a BubbleTextVie use the icon drawable for the preview
Test: Manual Testing
Fix: 286080714
Change-Id: I240521765312b37694ea0185c95ecb766b45c371
2023-08-18 00:33:53 +00:00
Sunny Goyal
eb018d8004 Removing some unused code:
> intrinsicIconScaleFactor is no longer read
> We no longer generatepreview outline for drag

Bug: 245997823
Test: Presubmit
Change-Id: I17ed25239d0affe89482da3406d529d323a426d9
2022-09-09 16:02:13 -07:00
Tony Wickham
c7cbf254f3 Let DragView use ActivityContext instead of Launcher
- Make DragView abstract and extended by LauncherDragView for the explicitly Launcher-specific parts.
- Some other methods like Utilities.getFullDrawable() now accept (Activity)Context rather than Launcher.

Test: Compiles and runs, manual drag and drop
Bug: 182981908
Change-Id: I77b7a2e48ce864dd711c3232217fdba4d60c546f
2021-05-25 15:35:55 -07:00
Steven Ng
3242720ce7 Inflate LauncherAppWidgetHostView directly in DragView
Also removes AppWidgetHostViewDrawable

Bug: 183609936
Test: drag-n-drop icons, folders, widgets, shortcuts

Change-Id: I26d8b05b9f9171037f2459fa2389e7e02c8ca6dc
2021-04-20 00:26:07 +01:00
Sunny Goyal
572aca4ce2 Moving some common functionality to IconLoaderLib
Bug: 183641907
Test: Manual
Change-Id: Icfc7ebb140e4e1678b0715beee2e0e513e707b9e
2021-03-25 10:06:53 -07:00
Steven Ng
0226d1ad79 Replace DragView bitmap with drawable
This is a preliminary work for local color extraction. In order to
apply local colors extracted from wallpaper to AppWidgetHostView
during drag, we need to hold a reference of the dragging
AppWidgetHostView.

In this CL, the following changes are made:
1. Instead of using bitmap image directly for icons, folders, shortcuts,
   legacy widget drawable preview, a BitmapDrawable wrapper is
    introduced.
2. Introduce a WidgetHostViewDraggableDrawable which draws
   LauncherAppWidgetHostView directly to canvas. No more bitmap
   generation overhead.
3. Remove drag outline from the drag logic because this will be replaced
   by a new grid color hint UI: https://screenshot.googleplex.com/7jBEVeuxFecFKKT.png

Test: Add: add widgets, shortcuts from widgets tray.
           add icons from all apps.
           create folder.
      Drag: drag existing widgets, shortcuts, folders and icons around

Bug: 182282587
Change-Id: Ia45ff756ea5bb80cf0761f0727a9453d50c204c0
2021-03-16 00:02:38 +00:00
Samuel Fufa
167210a323 Keep Predicted icon same size when dragging
-> In addition, this also prevents the drawing of ring effect for predicted icon when view is about to be copied to drag bitmap. Icon will scale to full size (without ring) when dropped.

Video attached to bug report

Bug: 152325754
Test: Manual
Change-Id: Ibd1a5dbf76c41bdc30ae851ad914a4d0e32703c8
2020-05-13 11:22:27 -07:00
Adam Cohen
c77bc45fa5 Fix issues with drag and drop from All Apps in non-default grids
=> Also fix the widget tray in these non-default grids, and the external shortcut addition flow. The layout was broken as it was scaling with the icon size. Instead keep it fixed which looks much better, similar to how we maintain all apps.
=> This also fixes a small jump when dragging shortcuts external to Launcher.

issue 154169001

Change-Id: Iad1e3859dd6fedccce9b5c6633e64426a4630c31
2020-05-08 16:00:08 -07:00
Adam Cohen
370164c4f7 Fix drag and drop regression when dragging a scaled widget
Missed this case in ag/10736229; the symptom was that if you picked up a widget when it was scaled due to split-screen, the widget would disappear

Test: manual

Change-Id: I26810fcf820f7053b6445989dce6598e1df55a8e
2020-04-08 18:00:35 -07:00
Adam Cohen
650869973a Refactor / Cleanup / Simplify a bunch of dnd related rendering / animation
Addresses:
=> Fix folder icon drop location mapping (was very far off)
=> Fix BubbleTextView drop animation shifted by a few pixels
=> Get rid multiple unnecessary calls to setDragMode(none), was breaking
   some of the reorder flow; still some issues to address here.
=> Fix folder icon parallax (didn't work when the folder had a dot)

Test: manual

Change-Id: I5959cf341996f75d30212353ec096ed25bf40ea5
2020-03-21 01:26:09 +00:00
Zak Cohen
3eeb41de9a Rename flag IS_DOGFOOD to IS_STUDIO.
The flag is only set when building from Android Studio... and is never
used for dogfood.

Test: local
Change-Id: I898d585f4558c2437f0152ef102bea59c351f80b
2020-02-14 14:19:59 -08:00
Samuel Fufa
45812a9ed6 Drag and drop preview size for BubbleTextView
Test:Manual
Bug:141260670,141263002
Change-Id: If08dba28cce3ae07bb39ddad3743dd5eea92cb90
2019-09-26 12:21:45 -07:00
Sunny Goyal
6fe3eec95c Moving various common executors to a single location
Change-Id: I44bca49b8adb6fa22c3b48d10f674e42c28d792c
2019-08-20 14:36:17 -07:00
Tony Wickham
d418f3c3fa Set FastBitmapDrawable scale=1 before drawing it in DragView
When we draw the icon to the DragView, we draw it
with the current scale, which is > 1 when animating
the icon down. Instead, we should always draw the
icon with scale 1 since the DragView itself is scaled.

Bug: 138236583
Change-Id: I6bca5cf28c54d58476240e0e68900a8f08ffe60b
2019-07-23 13:48:08 -07:00
Winson Chung
0d5ca096a0 Fix crash when rendering pending widget preview
- The pending widget disabled icon drawable is created from the icon backed
  by a hw bitmap, and when a user long presses the widget, we attempt to
  draw the drawable using a canvas backed by a software bitmap.

Bug: 112324288
Test: Pick up a pending app widget
Change-Id: Ied49112a2b03d54691f6db7c65e9267c8bd8e91f
2019-01-10 18:05:15 -08:00
Sunny Goyal
9a4c5be23e Moving some utility classes to icon lib
Change-Id: I0cc19ea02fb0732e9e1778a18c0d2c229232d179
2018-11-07 13:16:07 -08:00
Mario Bertschler
ab88b2243d Make drawDragView protected so it can be used in subclasses.
Bug: 73818519
Bug: 74404893
Change-Id: I75b8cc322bd8d96be83adbfaf2c0244df27019d8
2018-04-03 18:13:38 +02:00
Sunny Goyal
f3efc25862 Using public APIs for hardware bitmaps
Bug: 35428783
Change-Id: I4e7eeaa94e0cdfb1c76dce507a6f855e4eebbd6c
2018-03-06 15:16:21 -08:00
Derek Sollenberger
26a1b452f4 Stop using deprecated Canvas APIs.
Bug: 73777445
Test: compile
Change-Id: Ic0a1f4ebc10ba46229fd97408c052c0b450b4945
2018-03-01 04:39:57 +00:00
Sunny Goyal
29947f0b53 No more waiting around for resume
Apply model updates as son as they arrive instead of waiting for onResume.
Various workspace items do not use any configuration dependent resources.
For Widgets, we wait until the host starts lietening before inflating the actual view.

Change-Id: Icb2f5e5940c1ce6c27062ccd34eff87e80af5ab1
2017-12-19 12:50:17 -08:00
Sunny Goyal
9d32323cac First pass at using hardware bitmaps
Bug: 35428783
Change-Id: Ife67b85f6e7e268826597ed9bccd9659841f67de
2017-12-13 13:36:36 -08:00
Sunny Goyal
326403e958 Moving some calls off the UI thread
This saves ~5ms in onNewIntent

Bug: 67305604
Change-Id: Ic97727b1c526e50bd3c8a1d8f511e1d7fd5e05e7
2017-10-02 14:50:09 -07:00
Sunny Goyal
aa3a2baab6 Simplifying drag preview generation
> Fixing wrong icon normalization when dragging a folder icon
> Reusing the preview bitmap for creating dragOutline
> Generating drag outline on the background thread

Bug: 35428783
Change-Id: I01e724ba63404302090ee1e562f6c2fc7147ba2f
2017-09-27 09:10:05 -07:00
Hyunyoung Song
1322f9cb9a Fixing drag outline not getting drawn when the shortcuts popup is shown.
Shortucts popup uses predrag listener to manage the transient state of
the icon. Fixing the order of PredragListener, such that predragEnd gets
called before dragStart. This allows the transient state to be cleared
before any other state changes are done by onDragStart.

Bug: 62544416
Change-Id: I77c9a1aa17a15fe6f9f342af7a7fe3092a9d026b
2017-06-26 11:25:01 -07:00
Sunny Goyal
3d706ad703 Separating the config and flags in different directories so that
it is easier to override one or the other

Bug: 36001650
Change-Id: I713f4f5dbcf902614ce9f6c7a73bdace7bdf1ea0
2017-03-07 09:30:51 -08:00
Sunny Goyal
96ac68a481 Updating the PreloadIconDrawable
> The drawable gets the path from MaskIconDrawable path, instead of
  using a circle
> The progress changes are animated as well

Bug: 34831873
Change-Id: I4e7f0b610f4fd94de8e0cfcf8b179b775cf0b4d8
2017-02-06 10:43:27 -08:00
Jonathan Miranda
bf8a265deb Merge "Fix widget reorder animations in multi-window mode." into ub-launcher3-master 2016-12-30 00:42:11 +00:00
Jon Miranda
c9c57631a9 Fix clipping of drag outline by increasing padding.
Low resolution will be addressed in future CL.

Bug: 31915722
Change-Id: I6bdd32b7a30819fde1f15473a63ac280029b6715
2016-12-20 10:08:42 -08:00
Jon Miranda
2126691ce2 Fix widget reorder animations in multi-window mode.
The original animation assumed that the views are not
translated and not scaled. In multi-window mode this
assumption is no longer valid, because app widgets are
scaled and translated to fit center within their cells.

Bug: 32176631
Change-Id: Id60c793730d982277c9d91860e9fb0e6a0df7d38
2016-12-20 09:31:47 -08:00
Jon Miranda
f7ff3fe58a Scale widgets when dragging and dropping in multi-window mode.
This change mimics the non-MW mode behavior when dragging and
dropping widgets by taking the app widget scale into consideration.
This ensures a consistant drag and drop experience between
MW mode and non-MW mode.

* Uses cell data (cell height/width, spanX/Y) to get the expected
widget sizes.
* Scales sizes when necessary.

Bug: 32176631
Change-Id: Icdaf73ecd89a30e57fe7f405292d793f2d6a3ee8
2016-12-08 10:28:51 -08:00
Hyunyoung Song
0de011705b Code sanitization
- Removed bad method/class name typos

Change-Id: Ie6900e9e3d9ce9b550d2a2442a5dac3f7050a573
2016-10-06 10:57:29 -07:00
Sunny Goyal
10629b077c Moving some image handling classes to .graphics package
Change-Id: Id6d3d0b9c345a503ff2e09f073eb4b6449e21c7e
2016-09-02 12:34:33 -07:00
Sunny Goyal
f28e6afafd Some optimizations in blur outline generator
1) Using ALPHA_8 as the start and end bitmap. This removes one extra
   bitmap generation step
2) Using ByteBuffer on ALPHA_8 bitmap for clipAlpha. This allows us
   to use byteArray instead of intArray for representing pixels

Change-Id: I1b654c439fd491b6b91180ddc562bb97fad857aa
2016-09-02 11:23:49 -07:00
Sunny Goyal
06e21a2587 Moving the state changes during drag-n-drop from startDrag to onDragStart
This will allow drag controller to optinally defer drag, based on some
threshold, by simply deferring the callback onDragStart

Change-Id: I17c06a15e2092b9797c7e57529b12a53d2acae6e
2016-08-15 10:08:16 -07:00
Sunny Goyal
a2454ad2d8 Launcher shortcuts animations update.
> The shortcut container closes with an animation
> When opening/closing the animation only the icon scales
and not the title and drag handle
> When dragging the icon, it starts from the original icon position and
moves under the user finger. The container grows to follow the drag view.

Bug: 28980830
Change-Id: Ic0353c30b682d1f018cbf4d62e8a6e8e7d7d4664
2016-07-27 17:37:23 -07:00
Sunny Goyal
157793dda4 Increasing the size of the drag icon when a shortcut is dragged
Change-Id: I7d768657300d3229e05d1eb18aec3720a9098ffc
2016-07-21 15:18:24 -07:00