Moving Event dispatcher definition from LAuncher to BaseActivity so that

it can be used in other activities as well.

Bug: 34766840
Change-Id: Ie4b723483792bee93fb75e63146ebea7dfeebeda
This commit is contained in:
Sunny Goyal
2017-02-27 10:07:13 -08:00
parent 54d4e645b3
commit a535ae423b
6 changed files with 31 additions and 31 deletions

View File

@@ -21,9 +21,12 @@ import android.content.Context;
import android.content.ContextWrapper;
import android.view.View.AccessibilityDelegate;
import com.android.launcher3.logging.UserEventDispatcher;
public abstract class BaseActivity extends Activity {
protected DeviceProfile mDeviceProfile;
protected UserEventDispatcher mUserEventDispatcher;
public DeviceProfile getDeviceProfile() {
return mDeviceProfile;
@@ -33,6 +36,13 @@ public abstract class BaseActivity extends Activity {
return null;
}
public final UserEventDispatcher getUserEventDispatcher() {
if (mUserEventDispatcher == null) {
mUserEventDispatcher = UserEventDispatcher.get(this);
}
return mUserEventDispatcher;
}
public static BaseActivity fromContext(Context context) {
if (context instanceof BaseActivity) {
return (BaseActivity) context;