summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWinson <winsonc@google.com>2015-08-06 21:42:50 (GMT)
committerWinson <winsonc@google.com>2015-08-06 22:30:08 (GMT)
commitb0ca1a225f99a0a9b70419ed11e313b78ea1425c (patch)
tree3563948ec41d634797cce94be9cc7d124f092084
parentd1ea63f24a751521e6c35cc06be0e548e0b04f23 (diff)
downloadandroid_packages_apps_Trebuchet-b0ca1a225f99a0a9b70419ed11e313b78ea1425c.zip
android_packages_apps_Trebuchet-b0ca1a225f99a0a9b70419ed11e313b78ea1425c.tar.gz
android_packages_apps_Trebuchet-b0ca1a225f99a0a9b70419ed11e313b78ea1425c.tar.bz2
Fixing issue with miscalculation in updating container bounds.
- There was an issue with the previous logic where the test of whether the search bounds changed would always be false if valid search bounds were given. This in conjunction with the fact that the padding was changed to only take the bounds left/right into account, meant that the container bounds would not be updated if the search bar bounds shifted via the insets. Bug: 22918919 Change-Id: Ia810ddc7a56eae4afc0c7cd558fa6dc9e8e7a95b
-rw-r--r--src/com/android/launcher3/BaseContainerView.java22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/com/android/launcher3/BaseContainerView.java b/src/com/android/launcher3/BaseContainerView.java
index c8de9df..c118240 100644
--- a/src/com/android/launcher3/BaseContainerView.java
+++ b/src/com/android/launcher3/BaseContainerView.java
@@ -34,10 +34,12 @@ public abstract class BaseContainerView extends LinearLayout implements Insettab
// The bounds of the search bar. Only the left, top, right are used to inset the
// search bar and the height is determined by the measurement of the layout
private Rect mFixedSearchBarBounds = new Rect();
- // The bounds of the container
+ // The computed bounds of the search bar
+ private Rect mSearchBarBounds = new Rect();
+ // The computed bounds of the container
protected Rect mContentBounds = new Rect();
- // The padding to apply to the container to achieve the bounds
- protected Rect mContentPadding = new Rect();
+ // The computed padding to apply to the container to achieve the container bounds
+ private Rect mContentPadding = new Rect();
// The inset to apply to the edges and between the search bar and the container
private int mContainerBoundsInset;
private boolean mHasSearchBar;
@@ -90,7 +92,7 @@ public abstract class BaseContainerView extends LinearLayout implements Insettab
*/
protected void updateBackgroundAndPaddings() {
Rect padding;
- Rect searchBarBounds = new Rect(mFixedSearchBarBounds);
+ Rect searchBarBounds = new Rect();
if (!isValidSearchBarBounds(mFixedSearchBarBounds)) {
// Use the default bounds
padding = new Rect(mInsets.left + mContainerBoundsInset,
@@ -110,14 +112,20 @@ public abstract class BaseContainerView extends LinearLayout implements Insettab
(mHasSearchBar ? 0 : (mInsets.top + mContainerBoundsInset)),
getMeasuredWidth() - mFixedSearchBarBounds.right,
mInsets.bottom + mContainerBoundsInset);
+
+ // Use the search bounds
+ searchBarBounds.set(mFixedSearchBarBounds);
}
- if (!padding.equals(mContentPadding) || !searchBarBounds.equals(mFixedSearchBarBounds)) {
+
+ // If either the computed container padding has changed, or the computed search bar bounds
+ // has changed, then notify the container
+ if (!padding.equals(mContentPadding) || !searchBarBounds.equals(mSearchBarBounds)) {
mContentPadding.set(padding);
mContentBounds.set(padding.left, padding.top,
getMeasuredWidth() - padding.right,
getMeasuredHeight() - padding.bottom);
- mFixedSearchBarBounds.set(searchBarBounds);
- onUpdateBackgroundAndPaddings(mFixedSearchBarBounds, padding);
+ mSearchBarBounds.set(searchBarBounds);
+ onUpdateBackgroundAndPaddings(mSearchBarBounds, padding);
}
}