summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBjorn Bringert <bringert@google.com>2013-06-07 19:36:01 +0100
committerBjorn Bringert <bringert@google.com>2013-06-07 19:36:01 +0100
commitc459e5241ea0c53dd53c16e73fd7a187701f537b (patch)
tree0e38f09a0e86930edf44a5604230866ad9c26d74 /src
parent7564d98164c9fcba178e0ab0faf5066e33ad9a31 (diff)
downloadandroid_packages_apps_Trebuchet-c459e5241ea0c53dd53c16e73fd7a187701f537b.tar.gz
android_packages_apps_Trebuchet-c459e5241ea0c53dd53c16e73fd7a187701f537b.tar.bz2
android_packages_apps_Trebuchet-c459e5241ea0c53dd53c16e73fd7a187701f537b.zip
Allow subclassing Launcher
Changes included: - Make Launcher not final - Add some new methods as hooks for subclasses - Allow Launcher to intercept Workspace touch events Change-Id: I9a2b628c853394a3b237a384336e1b9e5c2382ec
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/Launcher.java27
-rw-r--r--src/com/android/launcher3/Workspace.java5
2 files changed, 28 insertions, 4 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index be83ee012..f7b6c5ad4 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -115,7 +115,7 @@ import java.util.Set;
/**
* Default launcher application.
*/
-public final class Launcher extends Activity
+public class Launcher extends Activity
implements View.OnClickListener, OnLongClickListener, LauncherModel.Callbacks,
View.OnTouchListener {
static final String TAG = "Launcher";
@@ -564,6 +564,10 @@ public final class Launcher extends Activity
}
}
+ public LayoutInflater getInflater() {
+ return mInflater;
+ }
+
public DragLayer getDragLayer() {
return mDragLayer;
}
@@ -1430,7 +1434,7 @@ public final class Launcher extends Activity
return mModel;
}
- void closeSystemDialogs() {
+ public void closeSystemDialogs() {
getWindow().closeAllPanels();
// Whatever we were doing is hereby canceled.
@@ -1629,14 +1633,20 @@ public final class Launcher extends Activity
sourceBounds = mSearchDropTargetBar.getSearchBarBounds();
}
+ startSearch(initialQuery, selectInitialQuery,
+ appSearchData, sourceBounds);
+ }
+
+ public void startSearch(String initialQuery,
+ boolean selectInitialQuery, Bundle appSearchData, Rect sourceBounds) {
startGlobalSearch(initialQuery, selectInitialQuery,
- appSearchData, sourceBounds);
+ appSearchData, sourceBounds);
}
/**
* Starts the global search activity. This code is a copied from SearchManager
*/
- public void startGlobalSearch(String initialQuery,
+ private void startGlobalSearch(String initialQuery,
boolean selectInitialQuery, Bundle appSearchData, Rect sourceBounds) {
final SearchManager searchManager =
(SearchManager) getSystemService(Context.SEARCH_SERVICE);
@@ -2060,6 +2070,10 @@ public final class Launcher extends Activity
public void onClickVoiceButton(View v) {
v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
+ startVoice();
+ }
+
+ public void startVoice() {
try {
final SearchManager searchManager =
(SearchManager) getSystemService(Context.SEARCH_SERVICE);
@@ -2883,6 +2897,11 @@ public final class Launcher extends Activity
// Send an accessibility event to announce the context change
getWindow().getDecorView()
.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
+
+ onWorkspaceShown();
+ }
+
+ public void onWorkspaceShown() {
}
void showAllApps(boolean animated) {
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index b4dc7d3b8..d600e9ef6 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -663,6 +663,11 @@ public class Workspace extends SmoothPagedView
}
}
}
+
+ if (mLauncher != null && mLauncher.onTouch(this, ev)) {
+ return true;
+ }
+
return super.onInterceptTouchEvent(ev);
}