diff options
author | cretin45 <cretin45@gmail.com> | 2016-03-08 12:18:15 -0800 |
---|---|---|
committer | cretin45 <cretin45@gmail.com> | 2016-03-08 12:45:19 -0800 |
commit | 0a244ba105d2f2b6b5427f5d4999b9db3c468e10 (patch) | |
tree | b818c5c1fd4859da95717d07ea4541d51bb1ead6 | |
parent | ff12f71fd3442f0718e192ec3c831fb18c032b1a (diff) | |
download | android_packages_apps_Trebuchet-0a244ba105d2f2b6b5427f5d4999b9db3c468e10.tar.gz android_packages_apps_Trebuchet-0a244ba105d2f2b6b5427f5d4999b9db3c468e10.tar.bz2 android_packages_apps_Trebuchet-0a244ba105d2f2b6b5427f5d4999b9db3c468e10.zip |
Trebuchet: Highlight section being touched even when not scrolling scrubber
Issue-id: CYNGNOS-1882
Change-Id: Ief8b6593528c1a04a95ffaeea44c379659427fd8
4 files changed, 39 insertions, 3 deletions
diff --git a/src/com/android/launcher3/BaseRecyclerView.java b/src/com/android/launcher3/BaseRecyclerView.java index cdf9aa2aa..d89c92270 100644 --- a/src/com/android/launcher3/BaseRecyclerView.java +++ b/src/com/android/launcher3/BaseRecyclerView.java @@ -321,6 +321,8 @@ public abstract class BaseRecyclerView extends RecyclerView public void setFastScrollDragging(boolean dragging) {} + public void setPreviousSectionFastScrollFocused() {} + /** * Updates the bounds for the scrollbar. * <p>Override in each subclass of this base class. diff --git a/src/com/android/launcher3/BaseRecyclerViewScrubber.java b/src/com/android/launcher3/BaseRecyclerViewScrubber.java index e3e08aa7c..7795de207 100644 --- a/src/com/android/launcher3/BaseRecyclerViewScrubber.java +++ b/src/com/android/launcher3/BaseRecyclerViewScrubber.java @@ -338,6 +338,10 @@ public class BaseRecyclerViewScrubber extends LinearLayout { } mBaseRecyclerView.setFastScrollDragging(mTouchingTrack); + if (mTouchingTrack) { + mBaseRecyclerView.setPreviousSectionFastScrollFocused(); + } + } } diff --git a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java index 3065fb428..643182588 100644 --- a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java +++ b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java @@ -80,6 +80,9 @@ public class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter. private int mGridTheme; + + private AlphabeticalAppsList.SectionInfo mFocusedSection; + /** * ViewHolder for each icon. */ @@ -572,6 +575,8 @@ public class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter. boolean hideIconLabels = SettingsProvider.getBoolean(mLauncher, SettingsProvider.SETTINGS_UI_DRAWER_HIDE_ICON_LABELS, R.bool.preferences_interface_drawer_hide_icon_labels_default); + FastScrollFocusApplicator.setFastScrollDimmed(holder.mContent, false, false); + FastScrollFocusApplicator.setFastScrollFocused(holder.mContent, false, false); switch (holder.getItemViewType()) { case ICON_VIEW_TYPE: { AppInfo info = mApps.getAdapterItems().get(position).appInfo; @@ -581,7 +586,8 @@ public class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter. icon.setTextVisibility(!hideIconLabels); } icon.applyFromApplicationInfo(info); - FastScrollFocusApplicator.setFastScrollDimmed(icon, mIconsDimmed, !mIconsDimmed); + FastScrollFocusApplicator.setFastScrollDimmed(icon, shouldDimPosition(position), + !mIconsDimmed); FastScrollFocusApplicator.setFastScrollFocused(icon, false, !mIconsDimmed); break; } @@ -593,7 +599,8 @@ public class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter. icon.setTextVisibility(!hideIconLabels); } icon.applyFromApplicationInfo(info); - FastScrollFocusApplicator.setFastScrollDimmed(icon, mIconsDimmed, !mIconsDimmed); + FastScrollFocusApplicator.setFastScrollDimmed(icon, shouldDimPosition(position), + !mIconsDimmed); FastScrollFocusApplicator.setFastScrollFocused(icon, false, !mIconsDimmed); mRemoteFolderManager.onBindViewHolder(holder, info); @@ -620,7 +627,8 @@ public class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter. case CUSTOM_PREDICTED_APPS_HEADER_VIEW_TYPE: { TextView title = (TextView) holder.mContent.findViewById(R.id.title); title.setTextColor(mAllAppsTextColor); - FastScrollFocusApplicator.setFastScrollDimmed(holder.mContent, mIconsDimmed, !mIconsDimmed); + FastScrollFocusApplicator.setFastScrollDimmed(holder.mContent, + shouldDimPosition(position), !mIconsDimmed); FastScrollFocusApplicator.setFastScrollFocused(holder.mContent, false, !mIconsDimmed); ViewGroup.MarginLayoutParams lp = @@ -637,6 +645,17 @@ public class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter. } } + private boolean shouldDimPosition(int position) { + if (mFocusedSection != null && mIconsDimmed) { + if (position >= mFocusedSection.firstAppItem.position && + position < mFocusedSection.firstAppItem.position + + mFocusedSection.numApps) { + return false; + } + } + return mIconsDimmed; + } + public int getCustomPredictedAppsOffset(int rowIndex) { int offset = mCustomPredictedAppsHeaderHeight; if (rowIndex > 0) offset += mCustomPredictedAppsFooterHeight; @@ -661,6 +680,11 @@ public class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter. } } + public void setFocusedSection( + AlphabeticalAppsList.SectionInfo focusedSection) { + mFocusedSection = focusedSection; + } + public void setGridTheme(int gridTheme) { mGridTheme = gridTheme; int sectionTextColorId = mGridTheme == AllAppsContainerView.GRID_THEME_DARK ? diff --git a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java index aaecf7a60..63acba5b2 100644 --- a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java +++ b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java @@ -416,6 +416,7 @@ public class AllAppsRecyclerView extends BaseRecyclerView private void setSectionFastScrollFocused(int position) { if (mPrevFastScrollFocusedSection != null) { + ((AllAppsGridAdapter)getAdapter()).setFocusedSection(mPrevFastScrollFocusedSection); int size = mPrevFastScrollFocusedSection.numApps + mPrevFastScrollFocusedSection.numOtherViews; for (int i = 0; i < size; i++) { @@ -429,6 +430,11 @@ public class AllAppsRecyclerView extends BaseRecyclerView } } + @Override + public void setPreviousSectionFastScrollFocused() { + setSectionFastScrollFocused(mPrevFastScrollFocusedPosition); + } + private void setSectionFastScrollDimmed(int position, boolean dimmed, boolean animate) { if (mPrevFastScrollFocusedSection != null) { int size = mPrevFastScrollFocusedSection.numApps + |