summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaj Yengisetty <rajesh@cyngn.com>2015-03-10 00:29:01 (GMT)
committerRaj Yengisetty <rajesh@cyngn.com>2015-03-10 00:29:03 (GMT)
commit861d111c8bd4efa55b676452e5a04feedc276527 (patch)
tree62e6efa0583fa06873507b1ead34851cb565cfdf
parent2372ffc2bbccac6a567488b76565213bae89d2ac (diff)
downloadandroid_packages_apps_Trebuchet-861d111c8bd4efa55b676452e5a04feedc276527.zip
android_packages_apps_Trebuchet-861d111c8bd4efa55b676452e5a04feedc276527.tar.gz
android_packages_apps_Trebuchet-861d111c8bd4efa55b676452e5a04feedc276527.tar.bz2
App Drawer: take dynamic grid updates
- Also fix row length so icons aren't cut off when large icons are enabled Change-Id: Iae95dc2380abee211eeed72eae08cafa4ec354f7
-rw-r--r--res/layout/drawer_icon.xml2
-rw-r--r--res/values/dimens.xml2
-rw-r--r--src/com/android/launcher3/AppDrawerListAdapter.java22
-rw-r--r--src/com/android/launcher3/Launcher.java1
4 files changed, 15 insertions, 12 deletions
diff --git a/res/layout/drawer_icon.xml b/res/layout/drawer_icon.xml
index 1cdea78..6c804f1 100644
--- a/res/layout/drawer_icon.xml
+++ b/res/layout/drawer_icon.xml
@@ -18,6 +18,8 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
+ android:paddingLeft="@dimen/vertical_app_drawer_icon_padding"
+ android:paddingRight="@dimen/vertical_app_drawer_icon_padding"
android:layout_height="wrap_content">
<ImageView
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 91bfaef..81e40bf 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -123,5 +123,5 @@
<dimen name="scrubber_height">48dp</dimen>
<!-- Vertical app drawer padding -->
- <dimen name="vertical_app_drawer_icon_padding">5px</dimen>
+ <dimen name="vertical_app_drawer_icon_padding">5dp</dimen>
</resources>
diff --git a/src/com/android/launcher3/AppDrawerListAdapter.java b/src/com/android/launcher3/AppDrawerListAdapter.java
index 84c96db..634ef3b 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 fd219d4..b1bafb1 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() {