summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcretin45 <cretin45@gmail.com>2016-03-08 12:18:15 -0800
committerTom Powell <zifnab@zifnab06.net>2017-03-26 16:18:40 -0700
commit284aaa3fc20426f204c2d570bafa1954ab33eeee (patch)
tree5db02adf6a58d8fd45953524aab4902f54fcaaad
parent73c6eb4fcf1ea4acbec7ae94670c3d0a65166ca2 (diff)
downloadandroid_packages_apps_Trebuchet-284aaa3fc20426f204c2d570bafa1954ab33eeee.zip
android_packages_apps_Trebuchet-284aaa3fc20426f204c2d570bafa1954ab33eeee.tar.gz
android_packages_apps_Trebuchet-284aaa3fc20426f204c2d570bafa1954ab33eeee.tar.bz2
Trebuchet: Highlight section being touched even when not scrolling scrubber
Issue-id: CYNGNOS-1882 Change-Id: Ief8b6593528c1a04a95ffaeea44c379659427fd8
-rw-r--r--src/com/android/launcher3/BaseRecyclerView.java2
-rw-r--r--src/com/android/launcher3/BaseRecyclerViewScrubber.java4
-rw-r--r--src/com/android/launcher3/allapps/AllAppsGridAdapter.java54
-rw-r--r--src/com/android/launcher3/allapps/AllAppsRecyclerView.java10
4 files changed, 68 insertions, 2 deletions
diff --git a/src/com/android/launcher3/BaseRecyclerView.java b/src/com/android/launcher3/BaseRecyclerView.java
index 77925b5..161b74e 100644
--- a/src/com/android/launcher3/BaseRecyclerView.java
+++ b/src/com/android/launcher3/BaseRecyclerView.java
@@ -313,6 +313,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 4299b44..1e36cda 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 a736f77..61a8962 100644
--- a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java
+++ b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java
@@ -73,6 +73,9 @@ public class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter.
private int mGridTheme;
+
+ private AlphabeticalAppsList.SectionInfo mFocusedSection;
+
/**
* ViewHolder for each icon.
*/
@@ -536,6 +539,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;
@@ -545,7 +550,9 @@ public class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter.
icon.setTextVisibility(!hideIconLabels);
}
icon.applyFromApplicationInfo(info);
- icon.setFastScrollDimmed(mIconsDimmed, !mIconsDimmed);
+ FastScrollFocusApplicator.setFastScrollDimmed(icon, shouldDimPosition(position),
+ !mIconsDimmed);
+ FastScrollFocusApplicator.setFastScrollFocused(icon, false, !mIconsDimmed);
break;
}
case PREDICTION_ICON_VIEW_TYPE: {
@@ -556,6 +563,11 @@ public class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter.
icon.setTextVisibility(!hideIconLabels);
}
icon.applyFromApplicationInfo(info);
+ FastScrollFocusApplicator.setFastScrollDimmed(icon, shouldDimPosition(position),
+ !mIconsDimmed);
+ FastScrollFocusApplicator.setFastScrollFocused(icon, false, !mIconsDimmed);
+
+ mRemoteFolderManager.onBindViewHolder(holder, info);
break;
}
case EMPTY_SEARCH_VIEW_TYPE:
@@ -576,7 +588,42 @@ public class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter.
searchView.setVisibility(View.GONE);
}
break;
+ case CUSTOM_PREDICTED_APPS_HEADER_VIEW_TYPE: {
+ TextView title = (TextView) holder.mContent.findViewById(R.id.title);
+ title.setTextColor(mAllAppsTextColor);
+ FastScrollFocusApplicator.setFastScrollDimmed(holder.mContent,
+ shouldDimPosition(position), !mIconsDimmed);
+ FastScrollFocusApplicator.setFastScrollFocused(holder.mContent, false, !mIconsDimmed);
+
+ ViewGroup.MarginLayoutParams lp =
+ (ViewGroup.MarginLayoutParams) holder.mContent.getLayoutParams();
+ mCustomPredictedAppsHeaderHeight = holder.mContent.getHeight() +
+ lp.topMargin + lp.bottomMargin;
+ break;
+ }
+ case CUSTOM_PREDICTED_APPS_FOOTER_VIEW_TYPE:
+ ViewGroup.MarginLayoutParams lp =
+ (ViewGroup.MarginLayoutParams) holder.mContent.getLayoutParams();
+ mCustomPredictedAppsFooterHeight = holder.mContent.getHeight() +
+ lp.topMargin + lp.bottomMargin;
+ }
+ }
+
+ 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;
+ return offset;
}
@Override
@@ -597,6 +644,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 6c853a0..0cb7780 100644
--- a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java
@@ -434,7 +434,10 @@ public class AllAppsRecyclerView extends BaseRecyclerView
private void setSectionFastScrollFocused(int position) {
if (mPrevFastScrollFocusedSection != null) {
- for (int i = 0; i < mPrevFastScrollFocusedSection.numApps; i++) {
+ ((AllAppsGridAdapter)getAdapter()).setFocusedSection(mPrevFastScrollFocusedSection);
+ int size = mPrevFastScrollFocusedSection.numApps +
+ mPrevFastScrollFocusedSection.numOtherViews;
+ for (int i = 0; i < size; i++) {
int sectionPosition = position+i;
final ViewHolder vh = findViewHolderForAdapterPosition(sectionPosition);
if (vh != null &&
@@ -449,6 +452,11 @@ public class AllAppsRecyclerView extends BaseRecyclerView
}
}
+ @Override
+ public void setPreviousSectionFastScrollFocused() {
+ setSectionFastScrollFocused(mPrevFastScrollFocusedPosition);
+ }
+
private void setSectionFastScrollDimmed(int position, boolean dimmed, boolean animate) {
if (mPrevFastScrollFocusedSection != null) {
for (int i = 0; i < mPrevFastScrollFocusedSection.numApps; i++) {