Merge "Refine all apps tabs alignment & remove ripple effect from tabs" into sc-dev

This commit is contained in:
Steven Ng 2021-06-28 16:38:50 +00:00 committed by Android (Google) Code Review
commit c9d5391bf2
3 changed files with 15 additions and 13 deletions

View File

@ -14,18 +14,14 @@
limitations under the License. limitations under the License.
--> -->
<selector xmlns:android="http://schemas.android.com/apk/res/android" <selector xmlns:android="http://schemas.android.com/apk/res/android"
android:enterFadeDuration="500"> android:enterFadeDuration="100">
<item <item
android:id="@+id/unselected" android:id="@+id/unselected"
android:state_selected="false"> android:state_selected="false">
<ripple android:color="@color/all_apps_tab_background_selected"> <shape android:shape="rectangle">
<item> <corners android:radius="@dimen/all_apps_header_pill_corner_radius" />
<shape android:shape="rectangle"> <solid android:color="@color/all_apps_tabs_background" />
<corners android:radius="@dimen/all_apps_header_pill_corner_radius" /> </shape>
<solid android:color="@color/all_apps_tabs_background" />
</shape>
</item>
</ripple>
</item> </item>
<item <item

View File

@ -454,8 +454,8 @@ public class AllAppsRecyclerView extends BaseRecyclerView {
*/ */
public int getTabWidth() { public int getTabWidth() {
DeviceProfile grid = BaseDraggingActivity.fromContext(getContext()).getDeviceProfile(); DeviceProfile grid = BaseDraggingActivity.fromContext(getContext()).getDeviceProfile();
int totalWidth = (grid.availableWidthPx - getPaddingLeft() - getPaddingRight()); int totalWidth = getMeasuredWidth() - getPaddingLeft() - getPaddingRight();
int iconPadding = totalWidth / grid.numShownAllAppsColumns - grid.allAppsIconSizePx; int iconPadding = totalWidth / grid.numShownAllAppsColumns - grid.allAppsIconSizePx;
return totalWidth - iconPadding; return totalWidth - iconPadding - grid.allAppsIconDrawablePaddingPx;
} }
} }

View File

@ -154,6 +154,14 @@ public class FloatingHeaderView extends LinearLayout implements
PluginManagerWrapper.INSTANCE.get(getContext()).removePluginListener(this); PluginManagerWrapper.INSTANCE.get(getContext()).removePluginListener(this);
} }
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
if (mMainRV != null) {
mTabLayout.getLayoutParams().width = mMainRV.getTabWidth();
}
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
private void recreateAllRowsArray() { private void recreateAllRowsArray() {
int pluginCount = mPluginRows.size(); int pluginCount = mPluginRows.size();
if (pluginCount == 0) { if (pluginCount == 0) {
@ -224,8 +232,6 @@ public class FloatingHeaderView extends LinearLayout implements
mTabsHidden = tabsHidden; mTabsHidden = tabsHidden;
mTabLayout.setVisibility(tabsHidden ? View.GONE : View.VISIBLE); mTabLayout.setVisibility(tabsHidden ? View.GONE : View.VISIBLE);
mTabLayout.getLayoutParams().width =
mAH[AllAppsContainerView.AdapterHolder.MAIN].recyclerView.getTabWidth();
mMainRV = setupRV(mMainRV, mAH[AllAppsContainerView.AdapterHolder.MAIN].recyclerView); mMainRV = setupRV(mMainRV, mAH[AllAppsContainerView.AdapterHolder.MAIN].recyclerView);
mWorkRV = setupRV(mWorkRV, mAH[AllAppsContainerView.AdapterHolder.WORK].recyclerView); mWorkRV = setupRV(mWorkRV, mAH[AllAppsContainerView.AdapterHolder.WORK].recyclerView);
mParent = (ViewGroup) mMainRV.getParent(); mParent = (ViewGroup) mMainRV.getParent();