diff options
| author | Winson Chung <winsonc@google.com> | 2014-04-21 19:26:09 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-04-21 19:26:09 +0000 |
| commit | deb1f268b7fc71ed23bac76af7dac6b5b04e8340 (patch) | |
| tree | 3fb7e5727561bf990a97acb35104f7845393642e /packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java | |
| parent | ad7b890f59d0493fb1d011c22721d68e2d22bf38 (diff) | |
| parent | ecd9b3031c9a322bd69380eae2810d53839e8f64 (diff) | |
| download | frameworks_base-deb1f268b7fc71ed23bac76af7dac6b5b04e8340.zip frameworks_base-deb1f268b7fc71ed23bac76af7dac6b5b04e8340.tar.gz frameworks_base-deb1f268b7fc71ed23bac76af7dac6b5b04e8340.tar.bz2 | |
Merge "Initial changes to add search bar."
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java')
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java index 5e5b841..d54df13 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java @@ -44,6 +44,8 @@ public class RecentsConfiguration { public int taskStackMaxDim; public int taskViewInfoPaneAnimDuration; public int taskViewRoundedCornerRadiusPx; + public int searchBarSpaceHeightPx; + public int searchBarSpaceEdgeMarginsPx; public boolean launchedWithThumbnailAnimation; @@ -92,6 +94,9 @@ public class RecentsConfiguration { res.getInteger(R.integer.recents_animate_task_view_info_pane_duration); taskViewRoundedCornerRadiusPx = res.getDimensionPixelSize(R.dimen.recents_task_view_rounded_corners_radius); + searchBarSpaceHeightPx = res.getDimensionPixelSize(R.dimen.recents_search_bar_space_height); + searchBarSpaceEdgeMarginsPx = + res.getDimensionPixelSize(R.dimen.recents_search_bar_space_edge_margins); } /** Updates the system insets */ @@ -99,6 +104,26 @@ public class RecentsConfiguration { systemInsets.set(insets); } + /** Returns the search bar bounds in the specified orientation */ + public void getSearchBarBounds(int width, int height, + Rect searchBarSpaceBounds, Rect searchBarBounds) { + // Return empty rects if search is not enabled + if (!Constants.DebugFlags.App.EnableSearchButton) { + searchBarSpaceBounds.set(0, 0, 0, 0); + searchBarBounds.set(0, 0, 0, 0); + return; + } + + // Calculate the search bar bounds, and account for the system insets + int edgeMarginPx = searchBarSpaceEdgeMarginsPx; + int availableWidth = width - systemInsets.left - systemInsets.right; + searchBarSpaceBounds.set(0, 0, availableWidth, 2 * edgeMarginPx + searchBarSpaceHeightPx); + + // Inset from the search bar space to get the search bar bounds + searchBarBounds.set(searchBarSpaceBounds); + searchBarBounds.inset(edgeMarginPx, edgeMarginPx); + } + /** Converts from DPs to PXs */ public int pxFromDp(float size) { return Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, |
