diff options
author | Adam Copp <adamcopp@google.com> | 2013-08-23 13:47:27 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-08-23 13:47:28 +0000 |
commit | eed7aa422f64e1a62d6d4ef96bf378ef9392a48b (patch) | |
tree | 1ba81acdea6022af291359d02e99382109508419 | |
parent | 8b0405888f69dfe36fec10811e2ef51ceb06cb59 (diff) | |
parent | 476493bcc3b2d6cf32db62bf78714aa0f2747108 (diff) | |
download | android_packages_apps_Trebuchet-eed7aa422f64e1a62d6d4ef96bf378ef9392a48b.tar.gz android_packages_apps_Trebuchet-eed7aa422f64e1a62d6d4ef96bf378ef9392a48b.tar.bz2 android_packages_apps_Trebuchet-eed7aa422f64e1a62d6d4ef96bf378ef9392a48b.zip |
Merge "Get the view to be used as qsb bar from the launcher directly." into jb-ub-gel-agar
-rw-r--r-- | res/layout/qsb_bar.xml | 7 | ||||
-rw-r--r-- | src/com/android/launcher3/DrawableStateProxyView.java | 6 | ||||
-rw-r--r-- | src/com/android/launcher3/DynamicGrid.java | 2 | ||||
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 18 | ||||
-rw-r--r-- | src/com/android/launcher3/SearchDropTargetBar.java | 15 |
5 files changed, 28 insertions, 20 deletions
diff --git a/res/layout/qsb_bar.xml b/res/layout/qsb_bar.xml index f0e3bbfce..030acf6be 100644 --- a/res/layout/qsb_bar.xml +++ b/res/layout/qsb_bar.xml @@ -20,13 +20,6 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - <!-- Search buttons container --> - <include android:id="@+id/qsb_search_bar" - layout="@layout/search_bar" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_gravity="center" /> - <!-- Drag specific targets container --> <LinearLayout style="@style/SearchDropTargetBar" diff --git a/src/com/android/launcher3/DrawableStateProxyView.java b/src/com/android/launcher3/DrawableStateProxyView.java index 196e2f2e1..0758de1f7 100644 --- a/src/com/android/launcher3/DrawableStateProxyView.java +++ b/src/com/android/launcher3/DrawableStateProxyView.java @@ -58,8 +58,10 @@ public class DrawableStateProxyView extends LinearLayout { View parent = (View) getParent(); mView = parent.findViewById(mViewId); } - mView.setPressed(isPressed()); - mView.setHovered(isHovered()); + if (mView != null) { + mView.setPressed(isPressed()); + mView.setHovered(isHovered()); + } } @Override diff --git a/src/com/android/launcher3/DynamicGrid.java b/src/com/android/launcher3/DynamicGrid.java index 37cccfbd3..593c4defb 100644 --- a/src/com/android/launcher3/DynamicGrid.java +++ b/src/com/android/launcher3/DynamicGrid.java @@ -321,7 +321,7 @@ class DeviceProfile { searchBarSpace.setLayoutParams(lp); // Layout the search bar - View searchBar = searchBarSpace.findViewById(R.id.qsb_search_bar); + View searchBar = launcher.getQsbBar(); lp = (FrameLayout.LayoutParams) searchBar.getLayoutParams(); lp.width = LayoutParams.MATCH_PARENT; lp.height = LayoutParams.MATCH_PARENT; diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index d5fafac56..70727c9c0 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -240,6 +240,7 @@ public class Launcher extends Activity private AppsCustomizeTabHost mAppsCustomizeTabHost; private AppsCustomizePagedView mAppsCustomizeContent; private boolean mAutoAdvanceRunning = false; + private View mQsbBar; private Bundle mSavedState; // We set the state in both onCreate and then onNewIntent in some cases, which causes both @@ -408,8 +409,8 @@ public class Launcher extends Activity checkForLocaleChange(); setContentView(R.layout.launcher); - grid.layout(this); setupViews(); + grid.layout(this); showFirstRunWorkspaceCling(); registerContentObservers(); @@ -3229,7 +3230,14 @@ public class Launcher extends Activity } } - private boolean updateGlobalSearchIcon() { + public View getQsbBar() { + if (mQsbBar == null) { + mQsbBar = mInflater.inflate(R.layout.qsb_bar, mSearchDropTargetBar); + } + return mQsbBar; + } + + protected boolean updateGlobalSearchIcon() { final View searchButtonContainer = findViewById(R.id.search_button_container); final ImageView searchButton = (ImageView) findViewById(R.id.search_button); final View voiceButtonContainer = findViewById(R.id.voice_button_container); @@ -3264,14 +3272,14 @@ public class Launcher extends Activity } } - private void updateGlobalSearchIcon(Drawable.ConstantState d) { + protected void updateGlobalSearchIcon(Drawable.ConstantState d) { final View searchButtonContainer = findViewById(R.id.search_button_container); final View searchButton = (ImageView) findViewById(R.id.search_button); updateButtonWithDrawable(R.id.search_button, d); invalidatePressedFocusedStates(searchButtonContainer, searchButton); } - private boolean updateVoiceSearchIcon(boolean searchVisible) { + protected boolean updateVoiceSearchIcon(boolean searchVisible) { final View voiceButtonContainer = findViewById(R.id.voice_button_container); final View voiceButton = findViewById(R.id.voice_button); @@ -3317,7 +3325,7 @@ public class Launcher extends Activity } } - private void updateVoiceSearchIcon(Drawable.ConstantState d) { + protected void updateVoiceSearchIcon(Drawable.ConstantState d) { final View voiceButtonContainer = findViewById(R.id.voice_button_container); final View voiceButton = findViewById(R.id.voice_button); updateButtonWithDrawable(R.id.voice_button, d); diff --git a/src/com/android/launcher3/SearchDropTargetBar.java b/src/com/android/launcher3/SearchDropTargetBar.java index 8f1b5d2d2..0a0861f47 100644 --- a/src/com/android/launcher3/SearchDropTargetBar.java +++ b/src/com/android/launcher3/SearchDropTargetBar.java @@ -23,6 +23,7 @@ import android.content.Context; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.util.AttributeSet; +import android.view.LayoutInflater; import android.view.View; import android.view.animation.AccelerateInterpolator; import android.widget.FrameLayout; @@ -71,6 +72,14 @@ public class SearchDropTargetBar extends FrameLayout implements DragController.D dragController.setFlingToDeleteDropTarget(mDeleteDropTarget); mInfoDropTarget.setLauncher(launcher); mDeleteDropTarget.setLauncher(launcher); + mQSBSearchBar = launcher.getQsbBar(); + if (mEnableDropDownDropTargets) { + mQSBSearchBarAnim = LauncherAnimUtils.ofFloat(mQSBSearchBar, "translationY", 0, + -mBarHeight); + } else { + mQSBSearchBarAnim = LauncherAnimUtils.ofFloat(mQSBSearchBar, "alpha", 1f, 0f); + } + setupAnimation(mQSBSearchBarAnim, mQSBSearchBar); } private void prepareStartAnimation(View v) { @@ -95,7 +104,6 @@ public class SearchDropTargetBar extends FrameLayout implements DragController.D super.onFinishInflate(); // Get the individual components - mQSBSearchBar = findViewById(R.id.qsb_search_bar); mDropTargetBar = findViewById(R.id.drag_target_bar); mInfoDropTarget = (ButtonDropTarget) mDropTargetBar.findViewById(R.id.info_target_text); mDeleteDropTarget = (ButtonDropTarget) mDropTargetBar.findViewById(R.id.delete_target_text); @@ -114,15 +122,12 @@ public class SearchDropTargetBar extends FrameLayout implements DragController.D mDropTargetBar.setTranslationY(-mBarHeight); mDropTargetBarAnim = LauncherAnimUtils.ofFloat(mDropTargetBar, "translationY", -mBarHeight, 0f); - mQSBSearchBarAnim = LauncherAnimUtils.ofFloat(mQSBSearchBar, "translationY", 0, - -mBarHeight); + } else { mDropTargetBar.setAlpha(0f); mDropTargetBarAnim = LauncherAnimUtils.ofFloat(mDropTargetBar, "alpha", 0f, 1f); - mQSBSearchBarAnim = LauncherAnimUtils.ofFloat(mQSBSearchBar, "alpha", 1f, 0f); } setupAnimation(mDropTargetBarAnim, mDropTargetBar); - setupAnimation(mQSBSearchBarAnim, mQSBSearchBar); } public void finishAnimations() { |