diff options
author | Raj Yengisetty <rajesh@cyngn.com> | 2015-03-09 17:29:01 -0700 |
---|---|---|
committer | Raj Yengisetty <rajesh@cyngn.com> | 2015-03-09 17:29:03 -0700 |
commit | 861d111c8bd4efa55b676452e5a04feedc276527 (patch) | |
tree | 62e6efa0583fa06873507b1ead34851cb565cfdf /src/com/android | |
parent | 2372ffc2bbccac6a567488b76565213bae89d2ac (diff) | |
download | android_packages_apps_Trebuchet-861d111c8bd4efa55b676452e5a04feedc276527.tar.gz android_packages_apps_Trebuchet-861d111c8bd4efa55b676452e5a04feedc276527.tar.bz2 android_packages_apps_Trebuchet-861d111c8bd4efa55b676452e5a04feedc276527.zip |
App Drawer: take dynamic grid updates
- Also fix row length so icons aren't cut off when large icons are enabled
Change-Id: Iae95dc2380abee211eeed72eae08cafa4ec354f7
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/launcher3/AppDrawerListAdapter.java | 22 | ||||
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 1 |
2 files changed, 12 insertions, 11 deletions
diff --git a/src/com/android/launcher3/AppDrawerListAdapter.java b/src/com/android/launcher3/AppDrawerListAdapter.java index 84c96dbbe..634ef3b15 100644 --- a/src/com/android/launcher3/AppDrawerListAdapter.java +++ b/src/com/android/launcher3/AppDrawerListAdapter.java @@ -94,7 +94,6 @@ public class AppDrawerListAdapter extends RecyclerView.Adapter<AppDrawerListAdap public AppDrawerListAdapter(Launcher launcher) { mLauncher = launcher; mHeaderList = new ArrayList<AppItemIndexedInfo>(); - mDeviceProfile = LauncherAppState.getInstance().getDynamicGrid().getDeviceProfile(); mLayoutInflater = LayoutInflater.from(launcher); mLocaleSetManager = new LocaleSetManager(mLauncher); @@ -105,12 +104,13 @@ public class AppDrawerListAdapter extends RecyclerView.Adapter<AppDrawerListAdap } private void initParams() { + mDeviceProfile = LauncherAppState.getInstance().getDynamicGrid().getDeviceProfile(); + + int width = mDeviceProfile.cellWidthPx + 2 * mDeviceProfile.edgeMarginPx; mIconParams = new - LinearLayout.LayoutParams(mDeviceProfile.folderCellWidthPx, - ViewGroup.LayoutParams.WRAP_CONTENT); - LauncherAppState app = LauncherAppState.getInstance(); - DeviceProfile grid = app.getDynamicGrid().getDeviceProfile(); - mIconRect = new Rect(0, 0, grid.allAppsIconSizePx, grid.allAppsIconSizePx); + LinearLayout.LayoutParams(width, ViewGroup.LayoutParams.WRAP_CONTENT); + mIconRect = new Rect(0, 0, mDeviceProfile.allAppsIconSizePx, + mDeviceProfile.allAppsIconSizePx); } /** @@ -176,6 +176,8 @@ public class AppDrawerListAdapter extends RecyclerView.Adapter<AppDrawerListAdap public void setApps(ArrayList<AppInfo> list) { if (!LauncherAppState.isDisableAllApps()) { + initParams(); + filterProtectedApps(list); mHeaderList.clear(); @@ -204,9 +206,10 @@ public class AppDrawerListAdapter extends RecyclerView.Adapter<AppDrawerListAdap } } - private void reset() { + public void reset() { ArrayList<AppInfo> infos = getAllApps(); + mLauncher.mAppDrawer.getLayoutManager().removeAllViews(); setApps(infos); } @@ -341,12 +344,8 @@ public class AppDrawerListAdapter extends RecyclerView.Adapter<AppDrawerListAdap for (int i = 0; i < mDeviceProfile.numColumnsBase; i++) { AppDrawerIconView icon = (AppDrawerIconView) mLayoutInflater.inflate( R.layout.drawer_icon, holder.mLayout, false); - icon.setLayoutParams(mIconParams); icon.setOnClickListener(mLauncher); icon.setOnLongClickListener(this); - int padding = (int) mLauncher.getResources() - .getDimension(R.dimen.vertical_app_drawer_icon_padding); - icon.setPadding(padding, padding, padding, padding); holder.mLayout.addView(icon); } return holder; @@ -377,6 +376,7 @@ public class AppDrawerListAdapter extends RecyclerView.Adapter<AppDrawerListAdap final int size = indexedInfo.mInfo.size(); for (int i = 0; i < holder.mLayout.getChildCount(); i++) { AppDrawerIconView icon = (AppDrawerIconView) holder.mLayout.getChildAt(i); + icon.setLayoutParams(mIconParams); if (i >= size) { icon.setVisibility(View.INVISIBLE); } else { diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index fd219d47d..b1bafb189 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -5775,6 +5775,7 @@ public class Launcher extends Activity mModel.startLoader(true, page); mWorkspace.updateCustomContentVisibility(); + mAppDrawerAdapter.reset(); } public void setUpdateDynamicGrid() { |