feat : initial implementation of LawnDeck (#5255)
Introducing the home screen layout feature! Now, users have the ability to personalize their experience by disabling the app drawer and arranging apps directly on their home screen. - closes : #4323
This commit is contained in:
1 parent
4c05942d34
commit
dd3725c30d
13 files changed
+498
-112
No files matched your search
@@ -31,6 +31,9 @@ import com.android.launcher3.model.data.CollectionInfo;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
import com.patrykmichalik.opto.core.PreferenceExtensionsKt;
|
||||
|
||||
import app.lawnchair.preferences2.PreferenceManager2;
|
||||
|
||||
public class DeleteDropTarget extends ButtonDropTarget {
|
||||
|
||||
@@ -38,6 +41,8 @@ public class DeleteDropTarget extends ButtonDropTarget {
|
||||
|
||||
private StatsLogManager.LauncherEvent mLauncherEvent;
|
||||
|
||||
private final PreferenceManager2 pref2;
|
||||
|
||||
public DeleteDropTarget(Context context) {
|
||||
this(context, null, 0);
|
||||
}
|
||||
@@ -49,6 +54,7 @@ public class DeleteDropTarget extends ButtonDropTarget {
|
||||
public DeleteDropTarget(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
this.mStatsLogManager = StatsLogManager.newInstance(context);
|
||||
pref2 = PreferenceManager2.getInstance(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -104,8 +110,14 @@ public class DeleteDropTarget extends ButtonDropTarget {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isCanDrop(ItemInfo item){
|
||||
return !(item.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION ||
|
||||
item.itemType == LauncherSettings.Favorites.ITEM_TYPE_FOLDER);
|
||||
}
|
||||
|
||||
private boolean canRemove(ItemInfo item) {
|
||||
return item.id != ItemInfo.NO_ID;
|
||||
boolean isDeckLayoutFirst = PreferenceExtensionsKt.firstBlocking(pref2.getDeckLayout());
|
||||
return isDeckLayoutFirst ? isCanDrop(item) : item.id != ItemInfo.NO_ID;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -144,6 +156,8 @@ public class DeleteDropTarget extends ButtonDropTarget {
|
||||
// because we already remove the drag view from the folder (if the drag originated from
|
||||
// a folder) in Folder.beginDrag()
|
||||
CharSequence announcement = getContext().getString(R.string.item_removed);
|
||||
mDropTargetHandler.onAccessibilityDelete(view, item, announcement);
|
||||
if (!PreferenceExtensionsKt.firstBlocking(pref2.getDeckLayout())) {
|
||||
mDropTargetHandler.onAccessibilityDelete(view, item, announcement);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user