summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/BaseActivity.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2018-07-12 18:45:27 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2018-07-12 18:45:27 +0000
commit0a40a187b589363f53172dc63d4111e3bda68ba7 (patch)
treec271d7cee99fded07ef62f913ce7d000238cffb6 /src/com/android/launcher3/BaseActivity.java
parent90218c44353f41ae6069996b848cf874bc3c22c7 (diff)
parent87b5eb689b49cc121961e95f0a5c929ee8ad6618 (diff)
downloadandroid_packages_apps_Trebuchet-0a40a187b589363f53172dc63d4111e3bda68ba7.tar.gz
android_packages_apps_Trebuchet-0a40a187b589363f53172dc63d4111e3bda68ba7.tar.bz2
android_packages_apps_Trebuchet-0a40a187b589363f53172dc63d4111e3bda68ba7.zip
Merge "Exposing some private methods to easily customize arrow popup" into ub-launcher3-master
Diffstat (limited to 'src/com/android/launcher3/BaseActivity.java')
-rw-r--r--src/com/android/launcher3/BaseActivity.java18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/com/android/launcher3/BaseActivity.java b/src/com/android/launcher3/BaseActivity.java
index fd69377b6..6c82e6385 100644
--- a/src/com/android/launcher3/BaseActivity.java
+++ b/src/com/android/launcher3/BaseActivity.java
@@ -26,6 +26,7 @@ import android.content.ContextWrapper;
import android.content.Intent;
import android.content.res.Configuration;
import android.support.annotation.IntDef;
+import android.view.ContextThemeWrapper;
import android.view.View.AccessibilityDelegate;
import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener;
@@ -116,13 +117,6 @@ public abstract class BaseActivity extends Activity implements UserEventDelegate
return Utilities.ATLEAST_NOUGAT && isInMultiWindowMode();
}
- public static BaseActivity fromContext(Context context) {
- if (context instanceof BaseActivity) {
- return (BaseActivity) context;
- }
- return ((BaseActivity) ((ContextWrapper) context).getBaseContext());
- }
-
public SystemUiController getSystemUiController() {
if (mSystemUiController == null) {
mSystemUiController = new SystemUiController(getWindow());
@@ -259,4 +253,14 @@ public abstract class BaseActivity extends Activity implements UserEventDelegate
writer.println(" mActivityFlags: " + mActivityFlags);
writer.println(" mForceInvisible: " + mForceInvisible);
}
+
+ public static <T extends BaseActivity> T fromContext(Context context) {
+ if (context instanceof BaseActivity) {
+ return (T) context;
+ } else if (context instanceof ContextThemeWrapper) {
+ return fromContext(((ContextWrapper) context).getBaseContext());
+ } else {
+ throw new IllegalArgumentException("Cannot find BaseActivity in parent tree");
+ }
+ }
}