Show shadow when entity header starts scrolling.

- Add a controller to manage add/remove onScrollChangedListener to
  recyclerviews.
- When recyclerview on each screen is scrolled to top, set actionbar
  elevation to 0, otherwise set it to non-zero.
- When screen is moved to background, detach the listener.
- Use the controller in entity header.

Change-Id: Iecf194d885098c98c392810f62893ae9189f3936
Fix: 37670670
Test: make RunSettingsRoboTests
This commit is contained in:
Fan Zhang
2017-05-22 09:50:38 -07:00
parent 7983dba5f6
commit 841d1d5aab
18 changed files with 277 additions and 57 deletions

View File

@@ -408,6 +408,7 @@ public class InstalledAppDetails extends AppInfoBase
mHeader = (LayoutPreference) findPreference(KEY_HEADER);
mActionButtons = (LayoutPreference) findPreference(KEY_ACTION_BUTTONS);
EntityHeaderController.newInstance(activity, this, mHeader.findViewById(R.id.entity_header))
.setRecyclerView(getListView(), getLifecycle())
.setPackageName(mPackageName)
.setButtonActions(EntityHeaderController.ActionType.ACTION_APP_PREFERENCE,
EntityHeaderController.ActionType.ACTION_NONE)
@@ -585,11 +586,11 @@ public class InstalledAppDetails extends AppInfoBase
final CharSequence summary =
isInstantApp ? null : getString(Utils.getInstallationStatus(mAppEntry.info));
EntityHeaderController.newInstance(activity, this, appSnippet)
.setLabel(mAppEntry)
.setIcon(mAppEntry)
.setSummary(summary)
.setIsInstantApp(isInstantApp)
.done(activity, false /* rebindActions */);
.setLabel(mAppEntry)
.setIcon(mAppEntry)
.setSummary(summary)
.setIsInstantApp(isInstantApp)
.done(activity, false /* rebindActions */);
mVersionPreference.setSummary(getString(R.string.version_text, pkgInfo.versionName));
}