summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/LauncherCallbacks.java
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2014-10-07 18:14:53 -0700
committerAdam Cohen <adamcohen@google.com>2014-10-15 11:49:50 -0700
commit9211d42f139eeaeeaef1fe4e59df2349e6d1237a (patch)
treeec3e30016441dd88baa7c5c8909325d4197d2f53 /src/com/android/launcher3/LauncherCallbacks.java
parent0014ca20aa35f8937ff0df105e620fba02a538a3 (diff)
downloadandroid_packages_apps_Trebuchet-9211d42f139eeaeeaef1fe4e59df2349e6d1237a.tar.gz
android_packages_apps_Trebuchet-9211d42f139eeaeeaef1fe4e59df2349e6d1237a.tar.bz2
android_packages_apps_Trebuchet-9211d42f139eeaeeaef1fe4e59df2349e6d1237a.zip
Use LauncherCallbacks model instead of method overrides
-> When extending the Launcher Activity, instead of overriding public and protected methods, create a proper interface -> This helps define the interface when extending Launcher more formally and more clearly Change-Id: Ib38e8a376b2242d4078bf6856bb145f5b5f0da80
Diffstat (limited to 'src/com/android/launcher3/LauncherCallbacks.java')
-rw-r--r--src/com/android/launcher3/LauncherCallbacks.java89
1 files changed, 89 insertions, 0 deletions
diff --git a/src/com/android/launcher3/LauncherCallbacks.java b/src/com/android/launcher3/LauncherCallbacks.java
new file mode 100644
index 000000000..aef2adc7f
--- /dev/null
+++ b/src/com/android/launcher3/LauncherCallbacks.java
@@ -0,0 +1,89 @@
+package com.android.launcher3;
+
+import android.content.ComponentName;
+import android.content.Intent;
+import android.graphics.Rect;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.View;
+
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+
+/**
+ * LauncherCallbacks is an interface used to extend the Launcher activity. It includes many hooks
+ * in order to add additional functionality. Some of these are very general, and give extending
+ * classes the ability to react to Activity life-cycle or specific user interactions. Others
+ * are more specific and relate to replacing parts of the application, for example, the search
+ * interface or the wallpaper picker.
+ */
+public interface LauncherCallbacks {
+
+ /*
+ * Activity life-cycle methods. These methods are triggered after
+ * the code in the corresponding Launcher method is executed.
+ */
+ public void preOnCreate();
+ public void onCreate(Bundle savedInstanceState);
+ public void preOnResume();
+ public void onResume();
+ public void onStart();
+ public void onStop();
+ public void onPause();
+ public void onDestroy();
+ public void onSaveInstanceState(Bundle outState);
+ public void onPostCreate(Bundle savedInstanceState);
+ public void onNewIntent(Intent intent);
+ public void onActivityResult(int requestCode, int resultCode, Intent data);
+ public void onWindowFocusChanged(boolean hasFocus);
+ public boolean onPrepareOptionsMenu(Menu menu);
+ public void dump(String prefix, FileDescriptor fd, PrintWriter w, String[] args);
+ public void onHomeIntent();
+ public boolean handleBackPressed();
+
+ /*
+ * Extension points for providing custom behavior on certain user interactions.
+ */
+ public void onLauncherProviderChange();
+ public void finishBindingItems(final boolean upgradePath);
+ public void onClickAllAppsButton(View v);
+ public void bindAllApplications(ArrayList<AppInfo> apps);
+ public void onClickFolderIcon(View v);
+ public void onClickAppShortcut(View v);
+ public void onClickPagedViewIcon(View v);
+ public void onClickWallpaperPicker(View v);
+ public void onClickSettingsButton(View v);
+ public void onClickAddWidgetButton(View v);
+ public void onPageSwitch(View newPage, int newPageIndex);
+ public void onWorkspaceLockedChanged();
+ public void onDragStarted(View view);
+ public void onInteractionBegin();
+ public void onInteractionEnd();
+
+ /*
+ * Extension points for replacing the search experience
+ */
+ public boolean forceDisableVoiceButtonProxy();
+ public boolean providesSearch();
+ public boolean startSearch(String initialQuery, boolean selectInitialQuery,
+ Bundle appSearchData, Rect sourceBounds);
+ public void startVoice();
+ public boolean hasCustomContentToLeft();
+ public void populateCustomContentContainer();
+ public View getQsbBar();
+
+ /*
+ * Extensions points for adding / replacing some other aspects of the Launcher experience.
+ */
+ public Intent getFirstRunActivity();
+ public boolean hasFirstRunActivity();
+ public boolean hasDismissableIntroScreen();
+ public View getIntroScreen();
+ public boolean shouldMoveToDefaultScreenOnHomeIntent();
+ public boolean hasSettings();
+ public ComponentName getWallpaperPickerComponent();
+ public boolean overrideWallpaperDimensions();
+ public boolean isLauncherPreinstalled();
+
+}