mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-28 15:56:49 +00:00
Scroll to show WidgetCell when it is tapped.
Scroll to show WidgetCell when it is tapped in a widget sheet. Otherwise, the add button may show/hide without the user seeing it if the bottom is clipped. Bug: 329861721 Test: manual- tap WidgetCell when top or bottom is scrolled out of view Flag: ACONFIG com.android.launcher3.enable_widget_tap_to_add TEAMFOOD Change-Id: Ie21730c193e845cb1c1fa447b7c0a7e719984a8f
This commit is contained in:
@@ -36,6 +36,9 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.android.launcher3.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A {@link LinearLayout} container which allows scrolling parts of its content based on the
|
||||
* scroll of a different view. Views which are marked as sticky are not scrolled, giving the
|
||||
@@ -242,6 +245,22 @@ public class StickyHeaderLayout extends LinearLayout implements
|
||||
return p instanceof MyLayoutParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of all the children that have the sticky layout param set.
|
||||
*/
|
||||
public List<View> getStickyChildren() {
|
||||
List<View> stickyChildren = new ArrayList<>();
|
||||
int count = getChildCount();
|
||||
for (int i = 0; i < count; i++) {
|
||||
View v = getChildAt(i);
|
||||
MyLayoutParams lp = (MyLayoutParams) v.getLayoutParams();
|
||||
if (lp.sticky) {
|
||||
stickyChildren.add(v);
|
||||
}
|
||||
}
|
||||
return stickyChildren;
|
||||
}
|
||||
|
||||
private static class MyLayoutParams extends LayoutParams {
|
||||
|
||||
public final boolean sticky;
|
||||
|
||||
Reference in New Issue
Block a user