Adds ENABLE_FLOATING_SEARCH_BOX flag for All Apps.

This defines how the All Apps screen should be laid out without
anchoring to the search bar at the top, as follows:
 - Header view aligns to the top instead of below search bar.
 - Same for A-Z list.
 - Scroller is aligned to the header view to receive the above
   adjustments automatically.
 - A-Z list is set above search bar to not peek from below.
 - Search bar is set to align parent bottom and translates up
   with the keyboard.
 - Button to disable work apps is raised above the search bar.

Bug: 213954333
Test: Manually with flag enabled/disabled, Always show keyboard
enabled/disabled, and work profile enabled/disabled.

Change-Id: If90bb39a890029fa7056367fe62bad0677f0b86e
This commit is contained in:
Andy Wickham
2022-01-31 17:57:06 -08:00
parent 14568de2ae
commit cf462e879a
9 changed files with 76 additions and 37 deletions
@@ -26,12 +26,14 @@ import android.os.Process;
import android.os.UserHandle;
import android.os.UserManager;
import android.util.Log;
import android.view.ViewGroup;
import androidx.annotation.IntDef;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import com.android.launcher3.R;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.util.ItemInfoMatcher;
import com.android.launcher3.workprofile.PersonalWorkSlidingTabStrip;
@@ -138,6 +140,15 @@ public class WorkProfileManager implements PersonalWorkSlidingTabStrip.OnActiveP
mWorkModeSwitch = (WorkModeSwitch) mAllApps.getLayoutInflater().inflate(
R.layout.work_mode_fab, mAllApps, false);
}
int workFabMarginBottom =
mWorkModeSwitch.getResources().getDimensionPixelSize(R.dimen.work_fab_margin);
if (FeatureFlags.ENABLE_FLOATING_SEARCH_BAR.get()) {
workFabMarginBottom <<= 1; // Double margin to add space above search bar.
workFabMarginBottom +=
mWorkModeSwitch.getResources().getDimensionPixelSize(R.dimen.qsb_widget_height);
}
((ViewGroup.MarginLayoutParams) mWorkModeSwitch.getLayoutParams()).bottomMargin =
workFabMarginBottom;
if (mWorkModeSwitch.getParent() != mAllApps) {
mAllApps.addView(mWorkModeSwitch);
}
@@ -158,7 +169,6 @@ public class WorkProfileManager implements PersonalWorkSlidingTabStrip.OnActiveP
mWorkModeSwitch = null;
}
public WorkAdapterProvider getAdapterProvider() {
return mAdapterProvider;
}