Loading core/java/com/android/internal/app/AbstractMultiProfilePagerAdapter.java +32 −7 Original line number Diff line number Diff line Loading @@ -340,6 +340,30 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter { protected abstract void showNoWorkToPersonalIntentsEmptyState( ResolverListAdapter activeListAdapter); /** * Updates padding and visibilities as a result of an orientation change. * <p>They are not updated automatically, because the view is cached when created. * <p>When overridden, make sure to always call the super method. */ void updateAfterConfigChange() { for (int i = 0; i < getItemCount(); i++) { ViewGroup emptyStateView = getItem(i).getEmptyStateView(); ImageView icon = emptyStateView.findViewById(R.id.resolver_empty_state_icon); updateIconVisibility(icon, emptyStateView); } } private void updateIconVisibility(ImageView icon, ViewGroup emptyStateView) { if (isSpinnerShowing(emptyStateView)) { icon.setVisibility(View.INVISIBLE); } else if (mWorkProfileUserHandle != null && !getContext().getResources().getBoolean(R.bool.resolver_landscape_phone)) { icon.setVisibility(View.VISIBLE); } else { icon.setVisibility(View.GONE); } } /** * The empty state screens are shown according to their priority: * <ol> Loading Loading @@ -441,7 +465,7 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter { ProfileDescriptor descriptor = getItem( userHandleToPageIndex(activeListAdapter.getUserHandle())); descriptor.rootView.findViewById(R.id.resolver_list).setVisibility(View.GONE); View emptyStateView = descriptor.getEmptyStateView(); ViewGroup emptyStateView = descriptor.getEmptyStateView(); resetViewVisibilitiesForWorkProfileEmptyState(emptyStateView); emptyStateView.setVisibility(View.VISIBLE); Loading @@ -464,12 +488,8 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter { button.setOnClickListener(buttonOnClick); ImageView icon = emptyStateView.findViewById(R.id.resolver_empty_state_icon); if (!getContext().getResources().getBoolean(R.bool.resolver_landscape_phone)) { icon.setVisibility(View.VISIBLE); icon.setImageResource(iconRes); } else { icon.setVisibility(View.GONE); } updateIconVisibility(icon, emptyStateView); activeListAdapter.markTabLoaded(); } Loading @@ -491,6 +511,11 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter { activeListAdapter.markTabLoaded(); } private boolean isSpinnerShowing(View emptyStateView) { return emptyStateView.findViewById(R.id.resolver_empty_state_progress).getVisibility() == View.VISIBLE; } private void showSpinner(View emptyStateView) { emptyStateView.findViewById(R.id.resolver_empty_state_icon).setVisibility(View.INVISIBLE); emptyStateView.findViewById(R.id.resolver_empty_state_title).setVisibility(View.INVISIBLE); Loading core/java/com/android/internal/app/ResolverActivity.java +19 −0 Original line number Diff line number Diff line Loading @@ -642,6 +642,9 @@ public class ResolverActivity extends Activity implements public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); mMultiProfilePagerAdapter.getActiveListAdapter().handlePackagesChanged(); if (isIntentPicker() && shouldShowTabs() && !useLayoutWithDefault()) { updateIntentPickerPaddings(); } if (mSystemWindowInsets != null) { mResolverDrawerLayout.setPadding(mSystemWindowInsets.left, mSystemWindowInsets.top, Loading @@ -649,6 +652,22 @@ public class ResolverActivity extends Activity implements } } private void updateIntentPickerPaddings() { View titleCont = findViewById(R.id.title_container); titleCont.setPadding( titleCont.getPaddingLeft(), titleCont.getPaddingTop(), titleCont.getPaddingRight(), getResources().getDimensionPixelSize(R.dimen.resolver_title_padding_bottom)); View buttonBar = findViewById(R.id.button_bar); buttonBar.setPadding( buttonBar.getPaddingLeft(), getResources().getDimensionPixelSize(R.dimen.resolver_button_bar_spacing), buttonBar.getPaddingRight(), getResources().getDimensionPixelSize(R.dimen.resolver_button_bar_spacing)); mMultiProfilePagerAdapter.updateAfterConfigChange(); } @Override // ResolverListCommunicator public void sendVoiceChoicesIfNeeded() { if (!isVoiceInteraction()) { Loading core/java/com/android/internal/app/ResolverMultiProfilePagerAdapter.java +19 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.internal.app; import android.annotation.Nullable; import android.content.Context; import android.content.res.Resources; import android.os.UserHandle; import android.view.LayoutInflater; import android.view.View; Loading Loading @@ -65,6 +66,24 @@ public class ResolverMultiProfilePagerAdapter extends AbstractMultiProfilePagerA mShouldShowNoCrossProfileIntentsEmptyState = shouldShowNoCrossProfileIntentsEmptyState; } @Override void updateAfterConfigChange() { super.updateAfterConfigChange(); for (ResolverProfileDescriptor descriptor : mItems) { View emptyStateCont = descriptor.rootView.findViewById(R.id.resolver_empty_state_container); Resources resources = getContext().getResources(); emptyStateCont.setPadding( emptyStateCont.getPaddingLeft(), resources.getDimensionPixelSize( R.dimen.resolver_empty_state_container_padding_top), emptyStateCont.getPaddingRight(), resources.getDimensionPixelSize( R.dimen.resolver_empty_state_container_padding_bottom)); } } private ResolverProfileDescriptor createProfileDescriptor( ResolverListAdapter adapter) { final LayoutInflater inflater = LayoutInflater.from(getContext()); Loading core/res/res/layout/resolver_empty_states.xml +2 −2 Original line number Diff line number Diff line Loading @@ -27,8 +27,8 @@ android:id="@+id/resolver_empty_state_container" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="48dp" android:paddingBottom="48dp" android:paddingTop="@dimen/resolver_empty_state_container_padding_top" android:paddingBottom="@dimen/resolver_empty_state_container_padding_bottom" android:gravity="center_horizontal"> <ImageView android:id="@+id/resolver_empty_state_icon" Loading core/res/res/layout/resolver_list.xml +2 −1 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ android:id="@id/contentPanel"> <RelativeLayout android:id="@+id/title_container" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alwaysShow="true" Loading @@ -33,7 +34,7 @@ android:paddingTop="@dimen/resolver_small_margin" android:paddingStart="@dimen/resolver_edge_margin" android:paddingEnd="@dimen/resolver_edge_margin" android:paddingBottom="@dimen/resolver_edge_margin" android:paddingBottom="@dimen/resolver_title_padding_bottom" android:background="@drawable/bottomsheet_background"> <TextView Loading Loading
core/java/com/android/internal/app/AbstractMultiProfilePagerAdapter.java +32 −7 Original line number Diff line number Diff line Loading @@ -340,6 +340,30 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter { protected abstract void showNoWorkToPersonalIntentsEmptyState( ResolverListAdapter activeListAdapter); /** * Updates padding and visibilities as a result of an orientation change. * <p>They are not updated automatically, because the view is cached when created. * <p>When overridden, make sure to always call the super method. */ void updateAfterConfigChange() { for (int i = 0; i < getItemCount(); i++) { ViewGroup emptyStateView = getItem(i).getEmptyStateView(); ImageView icon = emptyStateView.findViewById(R.id.resolver_empty_state_icon); updateIconVisibility(icon, emptyStateView); } } private void updateIconVisibility(ImageView icon, ViewGroup emptyStateView) { if (isSpinnerShowing(emptyStateView)) { icon.setVisibility(View.INVISIBLE); } else if (mWorkProfileUserHandle != null && !getContext().getResources().getBoolean(R.bool.resolver_landscape_phone)) { icon.setVisibility(View.VISIBLE); } else { icon.setVisibility(View.GONE); } } /** * The empty state screens are shown according to their priority: * <ol> Loading Loading @@ -441,7 +465,7 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter { ProfileDescriptor descriptor = getItem( userHandleToPageIndex(activeListAdapter.getUserHandle())); descriptor.rootView.findViewById(R.id.resolver_list).setVisibility(View.GONE); View emptyStateView = descriptor.getEmptyStateView(); ViewGroup emptyStateView = descriptor.getEmptyStateView(); resetViewVisibilitiesForWorkProfileEmptyState(emptyStateView); emptyStateView.setVisibility(View.VISIBLE); Loading @@ -464,12 +488,8 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter { button.setOnClickListener(buttonOnClick); ImageView icon = emptyStateView.findViewById(R.id.resolver_empty_state_icon); if (!getContext().getResources().getBoolean(R.bool.resolver_landscape_phone)) { icon.setVisibility(View.VISIBLE); icon.setImageResource(iconRes); } else { icon.setVisibility(View.GONE); } updateIconVisibility(icon, emptyStateView); activeListAdapter.markTabLoaded(); } Loading @@ -491,6 +511,11 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter { activeListAdapter.markTabLoaded(); } private boolean isSpinnerShowing(View emptyStateView) { return emptyStateView.findViewById(R.id.resolver_empty_state_progress).getVisibility() == View.VISIBLE; } private void showSpinner(View emptyStateView) { emptyStateView.findViewById(R.id.resolver_empty_state_icon).setVisibility(View.INVISIBLE); emptyStateView.findViewById(R.id.resolver_empty_state_title).setVisibility(View.INVISIBLE); Loading
core/java/com/android/internal/app/ResolverActivity.java +19 −0 Original line number Diff line number Diff line Loading @@ -642,6 +642,9 @@ public class ResolverActivity extends Activity implements public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); mMultiProfilePagerAdapter.getActiveListAdapter().handlePackagesChanged(); if (isIntentPicker() && shouldShowTabs() && !useLayoutWithDefault()) { updateIntentPickerPaddings(); } if (mSystemWindowInsets != null) { mResolverDrawerLayout.setPadding(mSystemWindowInsets.left, mSystemWindowInsets.top, Loading @@ -649,6 +652,22 @@ public class ResolverActivity extends Activity implements } } private void updateIntentPickerPaddings() { View titleCont = findViewById(R.id.title_container); titleCont.setPadding( titleCont.getPaddingLeft(), titleCont.getPaddingTop(), titleCont.getPaddingRight(), getResources().getDimensionPixelSize(R.dimen.resolver_title_padding_bottom)); View buttonBar = findViewById(R.id.button_bar); buttonBar.setPadding( buttonBar.getPaddingLeft(), getResources().getDimensionPixelSize(R.dimen.resolver_button_bar_spacing), buttonBar.getPaddingRight(), getResources().getDimensionPixelSize(R.dimen.resolver_button_bar_spacing)); mMultiProfilePagerAdapter.updateAfterConfigChange(); } @Override // ResolverListCommunicator public void sendVoiceChoicesIfNeeded() { if (!isVoiceInteraction()) { Loading
core/java/com/android/internal/app/ResolverMultiProfilePagerAdapter.java +19 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.internal.app; import android.annotation.Nullable; import android.content.Context; import android.content.res.Resources; import android.os.UserHandle; import android.view.LayoutInflater; import android.view.View; Loading Loading @@ -65,6 +66,24 @@ public class ResolverMultiProfilePagerAdapter extends AbstractMultiProfilePagerA mShouldShowNoCrossProfileIntentsEmptyState = shouldShowNoCrossProfileIntentsEmptyState; } @Override void updateAfterConfigChange() { super.updateAfterConfigChange(); for (ResolverProfileDescriptor descriptor : mItems) { View emptyStateCont = descriptor.rootView.findViewById(R.id.resolver_empty_state_container); Resources resources = getContext().getResources(); emptyStateCont.setPadding( emptyStateCont.getPaddingLeft(), resources.getDimensionPixelSize( R.dimen.resolver_empty_state_container_padding_top), emptyStateCont.getPaddingRight(), resources.getDimensionPixelSize( R.dimen.resolver_empty_state_container_padding_bottom)); } } private ResolverProfileDescriptor createProfileDescriptor( ResolverListAdapter adapter) { final LayoutInflater inflater = LayoutInflater.from(getContext()); Loading
core/res/res/layout/resolver_empty_states.xml +2 −2 Original line number Diff line number Diff line Loading @@ -27,8 +27,8 @@ android:id="@+id/resolver_empty_state_container" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="48dp" android:paddingBottom="48dp" android:paddingTop="@dimen/resolver_empty_state_container_padding_top" android:paddingBottom="@dimen/resolver_empty_state_container_padding_bottom" android:gravity="center_horizontal"> <ImageView android:id="@+id/resolver_empty_state_icon" Loading
core/res/res/layout/resolver_list.xml +2 −1 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ android:id="@id/contentPanel"> <RelativeLayout android:id="@+id/title_container" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alwaysShow="true" Loading @@ -33,7 +34,7 @@ android:paddingTop="@dimen/resolver_small_margin" android:paddingStart="@dimen/resolver_edge_margin" android:paddingEnd="@dimen/resolver_edge_margin" android:paddingBottom="@dimen/resolver_edge_margin" android:paddingBottom="@dimen/resolver_title_padding_bottom" android:background="@drawable/bottomsheet_background"> <TextView Loading