Adding support for keyboard based drag and drop

For keyboard DnD, we use Accessible DnD implementation.
A placeholder FloatingView draws the focus indicator
for the virtual views

Test: Visible
Bug: 178781566
Change-Id: I632fc7377dffa1e05e3f0a9c3ad18641deb5a1a4
This commit is contained in:
Sunny Goyal
2021-02-02 13:45:34 -08:00
parent d462965698
commit a4647b681f
18 changed files with 723 additions and 288 deletions

View File

@@ -131,7 +131,10 @@ public class DropTargetBar extends FrameLayout
int width = MeasureSpec.getSize(widthMeasureSpec);
int height = MeasureSpec.getSize(heightMeasureSpec);
if (mIsVertical) {
int visibleCount = getVisibleButtonsCount();
if (visibleCount == 0) {
// do nothing
} else if (mIsVertical) {
int widthSpec = MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY);
int heightSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST);
@@ -142,7 +145,6 @@ public class DropTargetBar extends FrameLayout
}
}
} else {
int visibleCount = getVisibleButtonsCount();
int availableWidth = width / visibleCount;
boolean textVisible = true;
for (ButtonDropTarget buttons : mDropTargets) {
@@ -165,7 +167,10 @@ public class DropTargetBar extends FrameLayout
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
if (mIsVertical) {
int visibleCount = getVisibleButtonsCount();
if (visibleCount == 0) {
// do nothing
} else if (mIsVertical) {
int gap = getResources().getDimensionPixelSize(R.dimen.drop_target_vertical_gap);
int start = gap;
int end;
@@ -178,7 +183,6 @@ public class DropTargetBar extends FrameLayout
}
}
} else {
int visibleCount = getVisibleButtonsCount();
int frameSize = (right - left) / visibleCount;
int start = frameSize / 2;