summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/AppDrawerListAdapter.java
diff options
context:
space:
mode:
authorArtem Shvadskiy <ashvadskiy@cyngn.com>2015-12-23 17:21:24 -0800
committerArtem Shvadskiy <ashvadskiy@cyngn.com>2016-01-04 17:46:57 -0800
commit1a75f660937c99d39110c3f1335ae3bea1a85914 (patch)
treea59d306f5ac0f37b930b286957646288ccf201b2 /src/com/android/launcher3/AppDrawerListAdapter.java
parentb7121babd1abedc085244a5145052ad453ce86a6 (diff)
downloadandroid_packages_apps_Trebuchet-1a75f660937c99d39110c3f1335ae3bea1a85914.tar.gz
android_packages_apps_Trebuchet-1a75f660937c99d39110c3f1335ae3bea1a85914.tar.bz2
android_packages_apps_Trebuchet-1a75f660937c99d39110c3f1335ae3bea1a85914.zip
Implement RemoteFolder metrics.
Additional changes: 1. Refactor drawer code to move xml and implementation out of trebuchet. 2. Move RemoteFolderUpdater to overlay, no stub class needed. 3. Pull TrackingEvent.Category out into EventCategory, and create overlay. 4. Remove old sync code from Folder. 5. Prevent RemoteFolder from inserting shortcuts into the database. All remote items will exist in memory only. 6. Move RemoteFolder into overlay, and have manager create an instance for FolderIcon. 7. Move folder sync out of LauncherModel. Patch 2: Re-add shortcut click handling in Folder and move EventCategory back into TrackingEvent.Category. Patch 3: Remove whitespace/javadoc/import changes. Change-Id: Ifc648f231bf6f6f35d8be45f8885f741b7539487 issue-id: CYNGNOS-1330
Diffstat (limited to 'src/com/android/launcher3/AppDrawerListAdapter.java')
-rw-r--r--src/com/android/launcher3/AppDrawerListAdapter.java64
1 files changed, 16 insertions, 48 deletions
diff --git a/src/com/android/launcher3/AppDrawerListAdapter.java b/src/com/android/launcher3/AppDrawerListAdapter.java
index fb47eb816..b3001e527 100644
--- a/src/com/android/launcher3/AppDrawerListAdapter.java
+++ b/src/com/android/launcher3/AppDrawerListAdapter.java
@@ -53,7 +53,7 @@ import java.util.LinkedHashMap;
* AppDrawerListAdapter - list adapter for the vertical app drawer
*/
public class AppDrawerListAdapter extends RecyclerView.Adapter<AppDrawerListAdapter.ViewHolder>
- implements View.OnLongClickListener, View.OnClickListener, DragSource, SectionIndexer {
+ implements View.OnLongClickListener, DragSource, SectionIndexer {
public static final String REMOTE_HEADER = "☆";
public static final String REMOTE_SCRUBBER = "★";
@@ -87,7 +87,7 @@ public class AppDrawerListAdapter extends RecyclerView.Adapter<AppDrawerListAdap
}
private static Bucket getBucketForApp(AppInfo app) {
- if (app.isRemote()) {
+ if (app.hasFlag(AppInfo.REMOTE_APP_FLAG)) {
return new Bucket(Integer.MIN_VALUE, REMOTE_HEADER);
} else {
LocaleUtils localeUtils = LocaleUtils.getInstance();
@@ -101,6 +101,8 @@ public class AppDrawerListAdapter extends RecyclerView.Adapter<AppDrawerListAdap
}
}
+ private final RemoteFolderManager mRemoteFolderManager;
+
private HashSet<AppInfo> mAllApps;
private ArrayList<AppItemIndexedInfo> mHeaderList;
private LayoutInflater mLayoutInflater;
@@ -147,8 +149,6 @@ public class AppDrawerListAdapter extends RecyclerView.Adapter<AppDrawerListAdap
public static int TYPE_NORMAL = 0;
public static int TYPE_CUSTOM = 1;
- public TextView mCustomTitleTextView;
- public ImageView mCustomImageView;
public AutoFitTextView mHeaderTextView;
public ViewGroup mIconLayout;
public View mContainerView;
@@ -161,8 +161,6 @@ public class AppDrawerListAdapter extends RecyclerView.Adapter<AppDrawerListAdap
mFadingBackgroundFrontView = itemView.findViewById(R.id.fading_background_front);
mHeaderTextView = (AutoFitTextView) itemView.findViewById(R.id.drawer_item_title);
mHeaderTextView.bringToFront();
- mCustomTitleTextView = (TextView) itemView.findViewById(R.id.custom_title);
- mCustomImageView = (ImageView) itemView.findViewById(R.id.custom_title_icon);
mIconLayout = (ViewGroup) itemView.findViewById(R.id.drawer_item_flow);
}
}
@@ -411,6 +409,8 @@ public class AppDrawerListAdapter extends RecyclerView.Adapter<AppDrawerListAdap
mAllApps = new HashSet<AppInfo>();
mLayoutInflater = LayoutInflater.from(launcher);
+ mRemoteFolderManager = mLauncher.getRemoteFolderManager();
+
mLocaleSetManager = new LocaleSetManager(mLauncher);
mLocaleSetManager.updateLocaleSet(mLocaleSetManager.getSystemLocaleSet());
mItemAnimatorSet = new ItemAnimatorSet(launcher);
@@ -600,8 +600,7 @@ public class AppDrawerListAdapter extends RecyclerView.Adapter<AppDrawerListAdap
}
if (viewType == ViewHolder.TYPE_CUSTOM) {
- applyCustomStyle(holder);
- holder.mCustomImageView.setOnClickListener(this);
+ mRemoteFolderManager.onCreateViewHolder(holder);
}
return holder;
@@ -686,20 +685,18 @@ public class AppDrawerListAdapter extends RecyclerView.Adapter<AppDrawerListAdap
mDeviceProfile.iconDrawablePaddingPx);
icon.mLabel.setText(info.title);
icon.mLabel.setVisibility(mHideIconLabels ? View.INVISIBLE : View.VISIBLE);
-
- if (info.isRemote()) {
- RemoteFolderUpdater.getInstance()
- .registerViewForInteraction(icon, info.getIntent());
- icon.mDraggable = false;
- }
}
}
holder.itemView.setTag(indexedInfo);
+
+ if (indexedInfo.isRemote()) {
+ mRemoteFolderManager.onBindViewHolder(holder, indexedInfo);
+ }
}
@Override
public boolean onLongClick(View v) {
- if (v instanceof AppDrawerIconView && ((AppDrawerIconView) v).mDraggable) {
+ if (v instanceof AppDrawerIconView) {
beginDraggingApplication(v);
mLauncher.enterSpringLoadedDragMode();
}
@@ -707,13 +704,6 @@ public class AppDrawerListAdapter extends RecyclerView.Adapter<AppDrawerListAdap
}
@Override
- public void onClick(View v) {
- if (v.getId() == R.id.custom_title_icon) {
- mLauncher.getRemoteFolderManager().onInfoIconClicked();
- }
- }
-
- @Override
public void onDropCompleted(View target, DropTarget.DragObject d, boolean isFlingToDelete,
boolean success) {
// Return early and wait for onFlingToDeleteCompleted if this was the result of a fling
@@ -829,6 +819,10 @@ public class AppDrawerListAdapter extends RecyclerView.Adapter<AppDrawerListAdap
public boolean isRemote() {
return mStartString == REMOTE_HEADER;
}
+
+ public ArrayList<AppInfo> getInfo() {
+ return mInfo;
+ }
}
@Override
@@ -893,30 +887,4 @@ public class AppDrawerListAdapter extends RecyclerView.Adapter<AppDrawerListAdap
}
}
}
-
- /**
- * Remote header uses a custom styled view. Apply it here.
- * @param holder view which needs a custom style.
- */
- private void applyCustomStyle(final ViewHolder holder) {
- Resources res = mLauncher.getResources();
- RelativeLayout.LayoutParams lp =
- (RelativeLayout.LayoutParams) holder.mHeaderTextView.getLayoutParams();
- lp.removeRule(RelativeLayout.ALIGN_BOTTOM);
- lp.topMargin = res.getDimensionPixelOffset(R.dimen.drawer_header_text_margin_top_custom);
-
- holder.mContainerView.setBackgroundColor(
- res.getColor(R.color.drawer_container_background_custom));
- holder.mCustomTitleTextView.setVisibility(View.VISIBLE);
- holder.mCustomImageView.setVisibility(View.VISIBLE);
- holder.mHeaderTextView.setTextSize(
- res.getDimension(R.dimen.drawer_header_text_size_custom));
- holder.mIconLayout.setPadding(0, 0, 0,
- res.getDimensionPixelOffset(R.dimen.drawer_item_flow_padding_bottom_custom));
-
- RecyclerView.LayoutParams containerLP =
- (RecyclerView.LayoutParams) holder.mContainerView.getLayoutParams();
- containerLP.bottomMargin =
- res.getDimensionPixelOffset(R.dimen.drawer_container_bottom_margin_custom);
- }
}