Merge "Improvements on layout with default intent resolver" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
ed64206471
@@ -437,9 +437,6 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter {
|
||||
resetViewVisibilitiesForWorkProfileEmptyState(emptyStateView);
|
||||
emptyStateView.setVisibility(View.VISIBLE);
|
||||
|
||||
View container = emptyStateView.findViewById(R.id.resolver_empty_state_container);
|
||||
setupContainerPadding(container);
|
||||
|
||||
TextView title = emptyStateView.findViewById(R.id.resolver_empty_state_title);
|
||||
title.setText(titleRes);
|
||||
|
||||
@@ -466,12 +463,6 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter {
|
||||
activeListAdapter.markTabLoaded();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up the padding of the view containing the empty state screens.
|
||||
* <p>This method is meant to be overridden so that subclasses can customize the padding.
|
||||
*/
|
||||
protected void setupContainerPadding(View container) {}
|
||||
|
||||
private void showConsumerUserNoAppsAvailableEmptyState(ResolverListAdapter activeListAdapter) {
|
||||
ProfileDescriptor descriptor = getItem(
|
||||
userHandleToPageIndex(activeListAdapter.getUserHandle()));
|
||||
@@ -564,6 +555,12 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback called when the button layout has been hidden.
|
||||
* <p>This method is meant to be overridden by subclasses.
|
||||
*/
|
||||
protected void onButtonLayoutHidden() { }
|
||||
|
||||
public interface OnProfileSelectedListener {
|
||||
/**
|
||||
* Callback for when the user changes the active tab from personal to work or vice versa.
|
||||
|
||||
@@ -180,7 +180,7 @@ public class ResolverActivity extends Activity implements
|
||||
public static final String EXTRA_IS_AUDIO_CAPTURE_DEVICE = "is_audio_capture_device";
|
||||
|
||||
private BroadcastReceiver mWorkProfileStateReceiver;
|
||||
private boolean mIsHeaderCreated;
|
||||
private UserHandle mHeaderCreatorUser;
|
||||
|
||||
/**
|
||||
* Get the string resource to be used as a label for the link to the resolver activity for an
|
||||
@@ -1730,11 +1730,10 @@ public class ResolverActivity extends Activity implements
|
||||
|
||||
/**
|
||||
* Configure the area above the app selection list (title, content preview, etc).
|
||||
* <p>The header is created once when first launching the activity and whenever a package is
|
||||
* installed or uninstalled.
|
||||
*/
|
||||
private void maybeCreateHeader(ResolverListAdapter listAdapter) {
|
||||
if (mIsHeaderCreated) {
|
||||
if (mHeaderCreatorUser != null
|
||||
&& !listAdapter.getUserHandle().equals(mHeaderCreatorUser)) {
|
||||
return;
|
||||
}
|
||||
if (!shouldShowTabs()
|
||||
@@ -1761,7 +1760,7 @@ public class ResolverActivity extends Activity implements
|
||||
if (iconView != null) {
|
||||
listAdapter.loadFilteredItemIconTaskAsync(iconView);
|
||||
}
|
||||
mIsHeaderCreated = true;
|
||||
mHeaderCreatorUser = listAdapter.getUserHandle();
|
||||
}
|
||||
|
||||
protected void resetButtonBar() {
|
||||
@@ -1777,13 +1776,18 @@ public class ResolverActivity extends Activity implements
|
||||
mMultiProfilePagerAdapter.getActiveListAdapter();
|
||||
View buttonBarDivider = findViewById(R.id.resolver_button_bar_divider);
|
||||
if (activeListAdapter.isTabLoaded()
|
||||
&& mMultiProfilePagerAdapter.shouldShowEmptyStateScreen(activeListAdapter)) {
|
||||
&& mMultiProfilePagerAdapter.shouldShowEmptyStateScreen(activeListAdapter)
|
||||
&& !useLayoutWithDefault()) {
|
||||
buttonLayout.setVisibility(View.INVISIBLE);
|
||||
buttonBarDivider.setVisibility(View.INVISIBLE);
|
||||
if (buttonBarDivider != null) {
|
||||
buttonBarDivider.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
mMultiProfilePagerAdapter.onButtonLayoutHidden();
|
||||
return;
|
||||
}
|
||||
|
||||
buttonBarDivider.setVisibility(View.VISIBLE);
|
||||
if (buttonBarDivider != null) {
|
||||
buttonBarDivider.setVisibility(View.VISIBLE);
|
||||
}
|
||||
buttonLayout.setVisibility(View.VISIBLE);
|
||||
|
||||
if (!useLayoutWithDefault()) {
|
||||
@@ -1872,7 +1876,6 @@ public class ResolverActivity extends Activity implements
|
||||
// turning on.
|
||||
return;
|
||||
}
|
||||
mIsHeaderCreated = false;
|
||||
boolean listRebuilt = mMultiProfilePagerAdapter.rebuildActiveTab(true);
|
||||
if (listRebuilt) {
|
||||
ResolverListAdapter activeListAdapter =
|
||||
|
||||
@@ -214,9 +214,12 @@ public class ResolverMultiProfilePagerAdapter extends AbstractMultiProfilePagerA
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupContainerPadding(View container) {
|
||||
container.setPadding(container.getPaddingLeft(), container.getPaddingTop(),
|
||||
container.getPaddingRight(), /* bottom */ 0);
|
||||
protected void onButtonLayoutHidden() {
|
||||
View emptyStateContainer = getItem(getCurrentPage()).getEmptyStateView()
|
||||
.findViewById(R.id.resolver_empty_state_container);
|
||||
emptyStateContainer.setPadding(emptyStateContainer.getPaddingLeft(),
|
||||
emptyStateContainer.getPaddingTop(), emptyStateContainer.getPaddingRight(),
|
||||
/* bottom */ 0);
|
||||
}
|
||||
|
||||
class ResolverProfileDescriptor extends ProfileDescriptor {
|
||||
|
||||
Reference in New Issue
Block a user