Merge "Improvements on layout with default intent resolver" into rvc-dev am: ed64206471
Change-Id: I87af6f89df9b5426bdefb82267d95b013e38fcc1
This commit is contained in:
@@ -437,9 +437,6 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter {
|
|||||||
resetViewVisibilitiesForWorkProfileEmptyState(emptyStateView);
|
resetViewVisibilitiesForWorkProfileEmptyState(emptyStateView);
|
||||||
emptyStateView.setVisibility(View.VISIBLE);
|
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);
|
TextView title = emptyStateView.findViewById(R.id.resolver_empty_state_title);
|
||||||
title.setText(titleRes);
|
title.setText(titleRes);
|
||||||
|
|
||||||
@@ -466,12 +463,6 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter {
|
|||||||
activeListAdapter.markTabLoaded();
|
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) {
|
private void showConsumerUserNoAppsAvailableEmptyState(ResolverListAdapter activeListAdapter) {
|
||||||
ProfileDescriptor descriptor = getItem(
|
ProfileDescriptor descriptor = getItem(
|
||||||
userHandleToPageIndex(activeListAdapter.getUserHandle()));
|
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 {
|
public interface OnProfileSelectedListener {
|
||||||
/**
|
/**
|
||||||
* Callback for when the user changes the active tab from personal to work or vice versa.
|
* 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";
|
public static final String EXTRA_IS_AUDIO_CAPTURE_DEVICE = "is_audio_capture_device";
|
||||||
|
|
||||||
private BroadcastReceiver mWorkProfileStateReceiver;
|
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
|
* 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).
|
* 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) {
|
private void maybeCreateHeader(ResolverListAdapter listAdapter) {
|
||||||
if (mIsHeaderCreated) {
|
if (mHeaderCreatorUser != null
|
||||||
|
&& !listAdapter.getUserHandle().equals(mHeaderCreatorUser)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!shouldShowTabs()
|
if (!shouldShowTabs()
|
||||||
@@ -1761,7 +1760,7 @@ public class ResolverActivity extends Activity implements
|
|||||||
if (iconView != null) {
|
if (iconView != null) {
|
||||||
listAdapter.loadFilteredItemIconTaskAsync(iconView);
|
listAdapter.loadFilteredItemIconTaskAsync(iconView);
|
||||||
}
|
}
|
||||||
mIsHeaderCreated = true;
|
mHeaderCreatorUser = listAdapter.getUserHandle();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void resetButtonBar() {
|
protected void resetButtonBar() {
|
||||||
@@ -1777,13 +1776,18 @@ public class ResolverActivity extends Activity implements
|
|||||||
mMultiProfilePagerAdapter.getActiveListAdapter();
|
mMultiProfilePagerAdapter.getActiveListAdapter();
|
||||||
View buttonBarDivider = findViewById(R.id.resolver_button_bar_divider);
|
View buttonBarDivider = findViewById(R.id.resolver_button_bar_divider);
|
||||||
if (activeListAdapter.isTabLoaded()
|
if (activeListAdapter.isTabLoaded()
|
||||||
&& mMultiProfilePagerAdapter.shouldShowEmptyStateScreen(activeListAdapter)) {
|
&& mMultiProfilePagerAdapter.shouldShowEmptyStateScreen(activeListAdapter)
|
||||||
|
&& !useLayoutWithDefault()) {
|
||||||
buttonLayout.setVisibility(View.INVISIBLE);
|
buttonLayout.setVisibility(View.INVISIBLE);
|
||||||
buttonBarDivider.setVisibility(View.INVISIBLE);
|
if (buttonBarDivider != null) {
|
||||||
|
buttonBarDivider.setVisibility(View.INVISIBLE);
|
||||||
|
}
|
||||||
|
mMultiProfilePagerAdapter.onButtonLayoutHidden();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (buttonBarDivider != null) {
|
||||||
buttonBarDivider.setVisibility(View.VISIBLE);
|
buttonBarDivider.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
buttonLayout.setVisibility(View.VISIBLE);
|
buttonLayout.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
if (!useLayoutWithDefault()) {
|
if (!useLayoutWithDefault()) {
|
||||||
@@ -1872,7 +1876,6 @@ public class ResolverActivity extends Activity implements
|
|||||||
// turning on.
|
// turning on.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mIsHeaderCreated = false;
|
|
||||||
boolean listRebuilt = mMultiProfilePagerAdapter.rebuildActiveTab(true);
|
boolean listRebuilt = mMultiProfilePagerAdapter.rebuildActiveTab(true);
|
||||||
if (listRebuilt) {
|
if (listRebuilt) {
|
||||||
ResolverListAdapter activeListAdapter =
|
ResolverListAdapter activeListAdapter =
|
||||||
|
|||||||
@@ -214,9 +214,12 @@ public class ResolverMultiProfilePagerAdapter extends AbstractMultiProfilePagerA
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setupContainerPadding(View container) {
|
protected void onButtonLayoutHidden() {
|
||||||
container.setPadding(container.getPaddingLeft(), container.getPaddingTop(),
|
View emptyStateContainer = getItem(getCurrentPage()).getEmptyStateView()
|
||||||
container.getPaddingRight(), /* bottom */ 0);
|
.findViewById(R.id.resolver_empty_state_container);
|
||||||
|
emptyStateContainer.setPadding(emptyStateContainer.getPaddingLeft(),
|
||||||
|
emptyStateContainer.getPaddingTop(), emptyStateContainer.getPaddingRight(),
|
||||||
|
/* bottom */ 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
class ResolverProfileDescriptor extends ProfileDescriptor {
|
class ResolverProfileDescriptor extends ProfileDescriptor {
|
||||||
|
|||||||
Reference in New Issue
Block a user