Refactor Folder to use ActivityContext and BaseDragLayer

These are the more generic versions of Launcher and DragLayer, so
that Folders can be used in other surfaces.

Test: Open and close Folders on home screen, ensure works properly
Bug: 171917176
Change-Id: I39b9aedbd8319ca61ea0e776bc95eab585e023d5
This commit is contained in:
Tony Wickham
2021-02-11 11:55:24 -08:00
parent e9110af0e0
commit 1906cc33f9
7 changed files with 109 additions and 77 deletions

View File

@@ -31,7 +31,6 @@ import android.graphics.Rect;
import android.os.Bundle;
import android.os.UserHandle;
import android.util.Log;
import android.view.ContextThemeWrapper;
import androidx.annotation.IntDef;
@@ -333,7 +332,7 @@ public abstract class BaseActivity extends Activity implements ActivityContext {
public static <T extends BaseActivity> T fromContext(Context context) {
if (context instanceof BaseActivity) {
return (T) context;
} else if (context instanceof ContextThemeWrapper) {
} else if (context instanceof ContextWrapper) {
return fromContext(((ContextWrapper) context).getBaseContext());
} else {
throw new IllegalArgumentException("Cannot find BaseActivity in parent tree");