Restore divider between app predictions and apps

Screenshot: https://screenshot.googleplex.com/89jJLU3JXV8tRXM
Bug: 180017741
Test: Manual
Change-Id: Iab1764fe94340f120770054cf5a59bd3ed9e45a4
This commit is contained in:
Samuel Fufa
2021-02-24 10:05:01 -06:00
parent c7d72e55ec
commit b984cf7fa6
5 changed files with 17 additions and 9 deletions
@@ -42,7 +42,6 @@ import com.android.launcher3.R;
import com.android.launcher3.allapps.FloatingHeaderRow;
import com.android.launcher3.allapps.FloatingHeaderView;
import com.android.launcher3.anim.PropertySetter;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.statemanager.StateManager.StateListener;
import com.android.launcher3.util.Themes;
@@ -183,11 +182,6 @@ public class AppsDividerView extends View implements StateListener<LauncherState
}
private void updateViewVisibility() {
// hide divider since we have item decoration for prediction row
if (FeatureFlags.ENABLE_DEVICE_SEARCH.get()) {
setVisibility(GONE);
return;
}
setVisibility(mDividerType == DividerType.NONE
? GONE
: (mIsScrolledOut ? INVISIBLE : VISIBLE));
@@ -108,7 +108,8 @@ public class PredictionRowView extends LinearLayout implements
AllAppsSectionDecorator.SectionDecorationHandler mDecorationHandler;
@Nullable private List<ItemInfo> mPendingPredictedItems;
@Nullable
private List<ItemInfo> mPendingPredictedItems;
public PredictionRowView(@NonNull Context context) {
this(context, null);
@@ -181,7 +182,7 @@ public class PredictionRowView extends LinearLayout implements
@Override
public boolean shouldDraw() {
return getVisibility() == VISIBLE;
return getVisibility() != GONE;
}
@Override
@@ -189,6 +190,11 @@ public class PredictionRowView extends LinearLayout implements
return mPredictionsEnabled;
}
@Override
public boolean isVisible() {
return getVisibility() == VISIBLE;
}
/**
* Returns the predicted apps.
*/
@@ -757,6 +757,7 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo
int bottomOffset = mWorkModeSwitch != null && mIsWork ? switchH : 0;
recyclerView.setPadding(padding.left, padding.top, padding.right,
padding.bottom + bottomOffset);
recyclerView.scrollToTop();
}
}
@@ -61,4 +61,11 @@ public interface FloatingHeaderRow {
* Returns a child that has focus to be launched by the IME.
*/
View getFocusedChild();
/**
* Returns true if view is currently visible
*/
default boolean isVisible() {
return shouldDraw();
}
}
@@ -200,7 +200,7 @@ public class FloatingHeaderView extends LinearLayout implements
public View getFocusedChild() {
if (FeatureFlags.ENABLE_DEVICE_SEARCH.get()) {
for (FloatingHeaderRow row : mAllRows) {
if (row.hasVisibleContent() && row.shouldDraw()) {
if (row.hasVisibleContent() && row.isVisible()) {
return row.getFocusedChild();
}
}