use of com.android.launcher3.widget.picker.WidgetsSpaceViewHolderBinder.EmptySpaceView in project android_packages_apps_404Launcher by P-404.
the class WidgetsRecyclerView method getCurrentScrollY.
@Override
public int getCurrentScrollY() {
// Skip early if widgets are not bound.
if (isModelNotReady() || getChildCount() == 0) {
return -1;
}
int rowIndex = -1;
View child = null;
LayoutManager layoutManager = getLayoutManager();
if (layoutManager instanceof LinearLayoutManager) {
// Use the LayoutManager as the source of truth for visible positions. During
// animations, the view group child may not correspond to the visible views that appear
// at the top.
rowIndex = ((LinearLayoutManager) layoutManager).findFirstVisibleItemPosition();
child = layoutManager.findViewByPosition(rowIndex);
}
if (child == null) {
// If the layout manager returns null for any reason, which can happen before layout
// has occurred for the position, then look at the child of this view as a ViewGroup.
child = getChildAt(0);
rowIndex = getChildPosition(child);
}
for (int i = 0; i < getChildCount(); i++) {
View view = getChildAt(i);
if (view instanceof TableLayout) {
// This assumes there is ever only one content shown in this recycler view.
mLastVisibleWidgetContentTableHeight = view.getMeasuredHeight();
} else if (view instanceof WidgetsListHeader && mWidgetHeaderHeight == 0 && view.getMeasuredHeight() > 0) {
// This assumes all header views are of the same height.
mWidgetHeaderHeight = view.getMeasuredHeight();
} else if (view instanceof EmptySpaceView && view.getMeasuredHeight() > 0) {
mWidgetEmptySpaceHeight = view.getMeasuredHeight();
}
}
int scrollPosition = getItemsHeight(rowIndex);
int offset = getLayoutManager().getDecoratedTop(child);
return getPaddingTop() + scrollPosition - offset;
}
use of com.android.launcher3.widget.picker.WidgetsSpaceViewHolderBinder.EmptySpaceView in project android_packages_apps_Launcher3 by AOSPA.
the class WidgetsRecyclerView method getCurrentScrollY.
@Override
public int getCurrentScrollY() {
// Skip early if widgets are not bound.
if (isModelNotReady() || getChildCount() == 0) {
return -1;
}
int rowIndex = -1;
View child = null;
LayoutManager layoutManager = getLayoutManager();
if (layoutManager instanceof LinearLayoutManager) {
// Use the LayoutManager as the source of truth for visible positions. During
// animations, the view group child may not correspond to the visible views that appear
// at the top.
rowIndex = ((LinearLayoutManager) layoutManager).findFirstVisibleItemPosition();
child = layoutManager.findViewByPosition(rowIndex);
}
if (child == null) {
// If the layout manager returns null for any reason, which can happen before layout
// has occurred for the position, then look at the child of this view as a ViewGroup.
child = getChildAt(0);
rowIndex = getChildPosition(child);
}
for (int i = 0; i < getChildCount(); i++) {
View view = getChildAt(i);
if (view instanceof TableLayout) {
// This assumes there is ever only one content shown in this recycler view.
mLastVisibleWidgetContentTableHeight = view.getMeasuredHeight();
} else if (view instanceof WidgetsListHeader && mWidgetHeaderHeight == 0 && view.getMeasuredHeight() > 0) {
// This assumes all header views are of the same height.
mWidgetHeaderHeight = view.getMeasuredHeight();
} else if (view instanceof EmptySpaceView && view.getMeasuredHeight() > 0) {
mWidgetEmptySpaceHeight = view.getMeasuredHeight();
}
}
int scrollPosition = getItemsHeight(rowIndex);
int offset = getLayoutManager().getDecoratedTop(child);
return getPaddingTop() + scrollPosition - offset;
}
use of com.android.launcher3.widget.picker.WidgetsSpaceViewHolderBinder.EmptySpaceView in project android_packages_apps_Launcher3 by AOSPA.
the class SearchAndRecommendationsScrollController method findCurrentEmptyView.
private void findCurrentEmptyView() {
if (mCurrentEmptySpaceView != null) {
mCurrentEmptySpaceView.setOnYChangeCallback(null);
mCurrentEmptySpaceView = null;
}
int childCount = mCurrentRecyclerView.getChildCount();
for (int i = 0; i < childCount; i++) {
View view = mCurrentRecyclerView.getChildAt(i);
if (view instanceof EmptySpaceView) {
mCurrentEmptySpaceView = (EmptySpaceView) view;
mCurrentEmptySpaceView.setFixedHeight(getHeaderHeight());
mCurrentEmptySpaceView.setOnYChangeCallback(this::updateHeaderScroll);
return;
}
}
}
Aggregations