diff options
author | Artem Shvadskiy <ashvadskiy@cyngn.com> | 2016-01-08 12:48:25 -0800 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2016-01-13 11:06:31 -0800 |
commit | 3c30f3ec6006c429e8751c0d0dfe7631fb161005 (patch) | |
tree | 5c8400c0a874200eb65d8f988c742fb6c205ceaa /src/com/android/launcher3/AppDrawerListAdapter.java | |
parent | d0cb9ae5d52de004ac0e326d5fbe9feb66c2c98c (diff) | |
download | android_packages_apps_Trebuchet-3c30f3ec6006c429e8751c0d0dfe7631fb161005.tar.gz android_packages_apps_Trebuchet-3c30f3ec6006c429e8751c0d0dfe7631fb161005.tar.bz2 android_packages_apps_Trebuchet-3c30f3ec6006c429e8751c0d0dfe7631fb161005.zip |
Implement placeholder icons for remote folder.
Patch 1: Unfinished temporary commit before rebase.
Patch 2: Rebase.
Patch 3:
1. Add additional RemoteFolderManager hook for drawer adapter setApps().
2. Replace method arguments in drawer adapter from ArrayList to List,
which allows us to use Collections.singletonList(), which is more memory
efficient.
3. Allow folders to batch remove a subset of their entries.
4. Remove unused remote flag in ShortcutInfo.
Patch 4: Fix placeholder animation for folder and folder icon.
Patch 5: Remove unused import.
Patch 6: Move app drawer bg color to overlay.
Change-Id: I5ae3b976e2d04dcfbe5ea2e563ef94dcae48b7d4
issue-id: CYNGNOS-1329
Diffstat (limited to 'src/com/android/launcher3/AppDrawerListAdapter.java')
-rw-r--r-- | src/com/android/launcher3/AppDrawerListAdapter.java | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/src/com/android/launcher3/AppDrawerListAdapter.java b/src/com/android/launcher3/AppDrawerListAdapter.java index b3001e527..c68f52f7a 100644 --- a/src/com/android/launcher3/AppDrawerListAdapter.java +++ b/src/com/android/launcher3/AppDrawerListAdapter.java @@ -21,7 +21,6 @@ import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.content.ComponentName; import android.content.Context; -import android.content.res.Resources; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.provider.Settings; @@ -34,11 +33,8 @@ import android.view.View; import android.view.ViewGroup; import android.view.animation.DecelerateInterpolator; import android.view.animation.Interpolator; -import android.widget.ImageView; import android.widget.LinearLayout; -import android.widget.RelativeLayout; import android.widget.SectionIndexer; -import android.widget.TextView; import com.android.launcher3.locale.LocaleSetManager; import com.android.launcher3.locale.LocaleUtils; import com.android.launcher3.settings.SettingsProvider; @@ -48,6 +44,7 @@ import java.util.Collections; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashMap; +import java.util.List; /** * AppDrawerListAdapter - list adapter for the vertical app drawer @@ -519,7 +516,7 @@ public class AppDrawerListAdapter extends RecyclerView.Adapter<AppDrawerListAdap Collections.sort(mHeaderList); } - public void setApps(ArrayList<AppInfo> list) { + public void setApps(List<AppInfo> list) { if (!LauncherAppState.isDisableAllApps()) { initParams(); @@ -559,7 +556,7 @@ public class AppDrawerListAdapter extends RecyclerView.Adapter<AppDrawerListAdap processApps(); } - public void updateApps(ArrayList<AppInfo> list) { + public void updateApps(List<AppInfo> list) { if (!LauncherAppState.isDisableAllApps()) { mAllApps.removeAll(list); mAllApps.addAll(list); @@ -567,11 +564,11 @@ public class AppDrawerListAdapter extends RecyclerView.Adapter<AppDrawerListAdap } } - public void addApps(ArrayList<AppInfo> list) { + public void addApps(List<AppInfo> list) { updateApps(list); } - public void removeApps(ArrayList<AppInfo> appInfos) { + public void removeApps(List<AppInfo> appInfos) { if (!LauncherAppState.isDisableAllApps()) { mAllApps.removeAll(appInfos); reset(); @@ -597,6 +594,11 @@ public class AppDrawerListAdapter extends RecyclerView.Adapter<AppDrawerListAdap icon.setOnClickListener(mLauncher); icon.setOnLongClickListener(this); holder.mIconLayout.addView(icon); + + icon.mIcon.setPadding(mDeviceProfile.iconDrawablePaddingPx, + mDeviceProfile.iconDrawablePaddingPx, + mDeviceProfile.iconDrawablePaddingPx, + mDeviceProfile.iconDrawablePaddingPx); } if (viewType == ViewHolder.TYPE_CUSTOM) { @@ -641,6 +643,10 @@ public class AppDrawerListAdapter extends RecyclerView.Adapter<AppDrawerListAdap public void onBindViewHolder(ViewHolder holder, int position) { AppItemIndexedInfo indexedInfo = mHeaderList.get(position); + if (indexedInfo.isRemote()) { + mRemoteFolderManager.onBindViewHolder(holder, indexedInfo); + } + holder.mHeaderTextView.setVisibility(indexedInfo.isChild ? View.INVISIBLE : View.VISIBLE); if (!indexedInfo.isChild) { holder.mHeaderTextView.setText(indexedInfo.mStartString); @@ -674,24 +680,22 @@ public class AppDrawerListAdapter extends RecyclerView.Adapter<AppDrawerListAdap } else { icon.setVisibility(View.VISIBLE); AppInfo info = indexedInfo.mInfo.get(i); - icon.setTag(info); - Drawable d = Utilities.createIconDrawable(info.iconBitmap); + + Drawable d; + if (info.customDrawable != null) { + d = info.customDrawable; + } else { + d = Utilities.createIconDrawable(info.iconBitmap); + } d.setBounds(mIconRect); icon.mIcon.setImageDrawable(d); - icon.mIcon.setPadding(mDeviceProfile.iconDrawablePaddingPx, - mDeviceProfile.iconDrawablePaddingPx, - mDeviceProfile.iconDrawablePaddingPx, - mDeviceProfile.iconDrawablePaddingPx); + icon.mLabel.setText(info.title); icon.mLabel.setVisibility(mHideIconLabels ? View.INVISIBLE : View.VISIBLE); } } holder.itemView.setTag(indexedInfo); - - if (indexedInfo.isRemote()) { - mRemoteFolderManager.onBindViewHolder(holder, indexedInfo); - } } @Override @@ -862,7 +866,7 @@ public class AppDrawerListAdapter extends RecyclerView.Adapter<AppDrawerListAdap return index; } - private void filterProtectedApps(ArrayList<AppInfo> list) { + private void filterProtectedApps(List<AppInfo> list) { updateProtectedAppsList(mLauncher); Iterator<AppInfo> iterator = list.iterator(); |