Refine all apps tabs alignment & remove ripple effect from tabs
Test: Open all apps and observe the position of tabs alignment.
Click a tab and observe the fade in color effect.
Fix: 191387242
Change-Id: Ie23a092268ce62eba29059eb5bd266a46ca652a5
diff --git a/res/drawable/all_apps_tabs_background.xml b/res/drawable/all_apps_tabs_background.xml
index bf7ee8c..aea2e7a 100644
--- a/res/drawable/all_apps_tabs_background.xml
+++ b/res/drawable/all_apps_tabs_background.xml
@@ -14,18 +14,14 @@
limitations under the License.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android"
- android:enterFadeDuration="500">
+ android:enterFadeDuration="100">
<item
android:id="@+id/unselected"
android:state_selected="false">
- <ripple android:color="@color/all_apps_tab_background_selected">
- <item>
- <shape android:shape="rectangle">
- <corners android:radius="@dimen/all_apps_header_pill_corner_radius" />
- <solid android:color="@color/all_apps_tabs_background" />
- </shape>
- </item>
- </ripple>
+ <shape android:shape="rectangle">
+ <corners android:radius="@dimen/all_apps_header_pill_corner_radius" />
+ <solid android:color="@color/all_apps_tabs_background" />
+ </shape>
</item>
<item
diff --git a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java
index 52dc19b..d7a69f1 100644
--- a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java
@@ -454,8 +454,8 @@
*/
public int getTabWidth() {
DeviceProfile grid = BaseDraggingActivity.fromContext(getContext()).getDeviceProfile();
- int totalWidth = (grid.availableWidthPx - getPaddingLeft() - getPaddingRight());
+ int totalWidth = getMeasuredWidth() - getPaddingLeft() - getPaddingRight();
int iconPadding = totalWidth / grid.numShownAllAppsColumns - grid.allAppsIconSizePx;
- return totalWidth - iconPadding;
+ return totalWidth - iconPadding - grid.allAppsIconDrawablePaddingPx;
}
}
diff --git a/src/com/android/launcher3/allapps/FloatingHeaderView.java b/src/com/android/launcher3/allapps/FloatingHeaderView.java
index f1381e9..8ea83d5 100644
--- a/src/com/android/launcher3/allapps/FloatingHeaderView.java
+++ b/src/com/android/launcher3/allapps/FloatingHeaderView.java
@@ -154,6 +154,14 @@
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() {
int pluginCount = mPluginRows.size();
if (pluginCount == 0) {
@@ -224,8 +232,6 @@
mTabsHidden = tabsHidden;
mTabLayout.setVisibility(tabsHidden ? View.GONE : View.VISIBLE);
- mTabLayout.getLayoutParams().width =
- mAH[AllAppsContainerView.AdapterHolder.MAIN].recyclerView.getTabWidth();
mMainRV = setupRV(mMainRV, mAH[AllAppsContainerView.AdapterHolder.MAIN].recyclerView);
mWorkRV = setupRV(mWorkRV, mAH[AllAppsContainerView.AdapterHolder.WORK].recyclerView);
mParent = (ViewGroup) mMainRV.getParent();