summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/Launcher.java
diff options
context:
space:
mode:
authorJorge Ruesga <jorge@ruesga.com>2014-02-24 01:04:33 +0100
committerMatt Garnes <matt@cyngn.com>2014-06-17 17:38:02 -0700
commit56db21e5af4c17f9308ceb07b0f3ab651743b5cd (patch)
tree03d9c1b1a761c78a277d888b3698ece86826df07 /src/com/android/launcher3/Launcher.java
parentcf43a17640a7eede4106670f97e0834b5ea0f976 (diff)
downloadandroid_packages_apps_Trebuchet-56db21e5af4c17f9308ceb07b0f3ab651743b5cd.tar.gz
android_packages_apps_Trebuchet-56db21e5af4c17f9308ceb07b0f3ab651743b5cd.tar.bz2
android_packages_apps_Trebuchet-56db21e5af4c17f9308ceb07b0f3ab651743b5cd.zip
trebuchet: custom home
Change-Id: I4faee66580ab0e41ee8e8bcbd79ce680d45bce97 Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
Diffstat (limited to 'src/com/android/launcher3/Launcher.java')
-rw-r--r--src/com/android/launcher3/Launcher.java44
1 files changed, 42 insertions, 2 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index d58170a2a..2947eda0f 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -56,6 +56,7 @@ import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Point;
import android.graphics.PorterDuff;
+import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.net.Uri;
@@ -99,6 +100,7 @@ import android.widget.PopupMenu;
import android.widget.TextView;
import android.widget.Toast;
+import com.android.launcher.home.Home;
import com.android.launcher3.DropTarget.DragObject;
import com.android.launcher3.PagedView.TransitionEffect;
import com.android.launcher3.settings.SettingsProvider;
@@ -289,6 +291,9 @@ public class Launcher extends Activity
private AppsCustomizePagedView mAppsCustomizeContent;
private boolean mAutoAdvanceRunning = false;
private View mQsb;
+ private View mQsbBar;
+ private ImageView mQsbBarSearch;
+ private ImageView mQsbBarVoice;
private Bundle mSavedState;
// We set the state in both onCreate and then onNewIntent in some cases, which causes both
@@ -578,6 +583,10 @@ public class Launcher extends Activity
}
/** To be overridden by subclasses to hint to Launcher that we have custom content */
+ protected boolean hasCustomSearchSupport() {
+ return false;
+ }
+
protected boolean hasCustomContentToLeft() {
return isGelIntegrationSupported() && isGelIntegrationEnabled();
}
@@ -652,6 +661,15 @@ public class Launcher extends Activity
}
}
+ /** To be overriden by subclasses to hint to Launcher that we have custom content and
+ * support {@link #hasCustomSearchSupport()}
+ * @see com.android.launcher.home.Home#MODE_SEARCH_TEXT
+ * @see com.android.launcher.home.Home#MODE_SEARCH_VOICE
+ * */
+ protected void requestSearch(int mode) {
+ // To be implemented
+ }
+
private void updateGlobalIcons() {
boolean searchVisible = false;
boolean voiceVisible = false;
@@ -2739,8 +2757,12 @@ public class Launcher extends Activity
* @param v The view that was clicked.
*/
public void onClickSearchButton(View v) {
- v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
+ if (hasCustomSearchSupport()) {
+ requestSearch(Home.MODE_SEARCH_TEXT);
+ return;
+ }
+ v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
onSearchRequested();
}
@@ -2750,8 +2772,12 @@ public class Launcher extends Activity
* @param v The view that was clicked.
*/
public void onClickVoiceButton(View v) {
- v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
+ if (hasCustomSearchSupport()) {
+ requestSearch(Home.MODE_SEARCH_VOICE);
+ return;
+ }
+ v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
startVoice();
}
@@ -3825,6 +3851,20 @@ public class Launcher extends Activity
return mQsb;
}
+ public ImageView getQsbBarSearchButton() {
+ if (mQsbBarSearch == null && getQsbBar() != null) {
+ return (ImageView) getQsbBar().findViewById(R.id.search_button);
+ }
+ return mQsbBarSearch;
+ }
+
+ public ImageView getQsbBarVoiceButton() {
+ if (mQsbBarVoice == null && getQsbBar() != null) {
+ return (ImageView) getQsbBar().findViewById(R.id.voice_button);
+ }
+ return mQsbBarVoice;
+ }
+
protected boolean updateGlobalSearchIcon() {
final View searchButtonContainer = findViewById(R.id.search_button_container);
final ImageView searchButton = (ImageView) findViewById(R.id.search_button);