summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoey Rizzoli <joey@lineageos.org>2017-11-09 16:05:00 +0100
committerArne Coucheron <arco68@gmail.com>2018-01-19 00:27:13 +0100
commit97105a6eb4de7a9ec0509b5c60c05ab0f4aef08c (patch)
treea06bb7480f538ffae254a6928902cf982aa11b39
parentaca5a8bc95c1461419039a2041a8a54a84f49790 (diff)
downloadandroid_packages_apps_Trebuchet-97105a6eb4de7a9ec0509b5c60c05ab0f4aef08c.tar.gz
android_packages_apps_Trebuchet-97105a6eb4de7a9ec0509b5c60c05ab0f4aef08c.tar.bz2
android_packages_apps_Trebuchet-97105a6eb4de7a9ec0509b5c60c05ab0f4aef08c.zip
Launcher3: custom grid
Signed-off-by: Arne Coucheron <arco68@gmail.com> Signed-off-by: Joey Rizzoli <joey@lineageos.org>
-rw-r--r--res/layout/dialog_custom_grid.xml59
-rw-r--r--res/values/attrs.xml1
-rw-r--r--res/values/lineage_strings.xml9
-rw-r--r--res/xml/device_profiles.xml11
-rw-r--r--res/xml/launcher_preferences.xml5
-rw-r--r--src/com/android/launcher3/DeviceProfile.java2
-rw-r--r--src/com/android/launcher3/InvariantDeviceProfile.java41
-rw-r--r--src/com/android/launcher3/SettingsActivity.java99
-rw-r--r--src/com/android/launcher3/Utilities.java28
-rw-r--r--src/com/android/launcher3/allapps/AllAppsContainerView.java8
10 files changed, 249 insertions, 14 deletions
diff --git a/res/layout/dialog_custom_grid.xml b/res/layout/dialog_custom_grid.xml
new file mode 100644
index 000000000..aa54b78f7
--- /dev/null
+++ b/res/layout/dialog_custom_grid.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2017 The LineageOS Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="horizontal"
+ android:padding="16dp">
+
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:orientation="vertical">
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textAlignment="center"
+ android:text="@string/grid_size_columns" />
+
+ <NumberPicker
+ android:id="@+id/dialog_grid_column"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="8dp" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:orientation="vertical">
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textAlignment="center"
+ android:text="@string/grid_size_rows" />
+
+ <NumberPicker
+ android:id="@+id/dialog_grid_row"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="8dp" />
+ </LinearLayout>
+</LinearLayout> \ No newline at end of file
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 5aee715b6..9e6d4714e 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -109,6 +109,7 @@
<attr name="numRows" format="integer" />
<attr name="numColumns" format="integer" />
+ <attr name="numColumnsDrawer" format="integer" />
<!-- numFolderRows & numFolderColumns defaults to numRows & numColumns, if not specified -->
<attr name="numFolderRows" format="integer" />
<attr name="numFolderColumns" format="integer" />
diff --git a/res/values/lineage_strings.xml b/res/values/lineage_strings.xml
index fe574ebba..c96dc5af2 100644
--- a/res/values/lineage_strings.xml
+++ b/res/values/lineage_strings.xml
@@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+<resources>
<!-- Application name -->
<string name="lineageos_app_name" translatable="false">Trebuchet</string>
@@ -29,4 +29,11 @@
<string name="predictive_apps_title">Predictive apps</string>
<string name="predictive_apps_summary_on">Your favorite apps will appear at the top of the drawer</string>
<string name="predictive_apps_summary_off">Your favorite apps won\'t appear at the top of the drawer</string>
+
+ <!-- Grid size -->
+ <string name="grid_size_text">Grid size</string>
+ <string name="grid_size_rows">Rows</string>
+ <string name="grid_size_columns">Columns</string>
+ <string name="grid_size_custom_positive">Set</string>
+ <string name="grid_size_custom_message">Select custom columns and rows count</string>
</resources>
diff --git a/res/xml/device_profiles.xml b/res/xml/device_profiles.xml
index d4de77ae8..c5cec46e1 100644
--- a/res/xml/device_profiles.xml
+++ b/res/xml/device_profiles.xml
@@ -23,6 +23,7 @@
launcher:minHeightDps="300"
launcher:numRows="2"
launcher:numColumns="3"
+ launcher:numColumnsDrawer="3"
launcher:numFolderRows="2"
launcher:numFolderColumns="3"
launcher:minAllAppsPredictionColumns="3"
@@ -38,6 +39,7 @@
launcher:minHeightDps="400"
launcher:numRows="3"
launcher:numColumns="3"
+ launcher:numColumnsDrawer="3"
launcher:numFolderRows="3"
launcher:numFolderColumns="3"
launcher:minAllAppsPredictionColumns="3"
@@ -53,6 +55,7 @@
launcher:minHeightDps="420"
launcher:numRows="3"
launcher:numColumns="4"
+ launcher:numColumnsDrawer="4"
launcher:numFolderRows="3"
launcher:numFolderColumns="4"
launcher:minAllAppsPredictionColumns="4"
@@ -68,6 +71,7 @@
launcher:minHeightDps="450"
launcher:numRows="3"
launcher:numColumns="4"
+ launcher:numColumnsDrawer="4"
launcher:numFolderRows="3"
launcher:numFolderColumns="4"
launcher:minAllAppsPredictionColumns="4"
@@ -83,6 +87,7 @@
launcher:minHeightDps="491.33"
launcher:numRows="5"
launcher:numColumns="4"
+ launcher:numColumnsDrawer="4"
launcher:numFolderRows="4"
launcher:numFolderColumns="4"
launcher:minAllAppsPredictionColumns="4"
@@ -98,6 +103,7 @@
launcher:minHeightDps="567"
launcher:numRows="5"
launcher:numColumns="4"
+ launcher:numColumnsDrawer="4"
launcher:numFolderRows="4"
launcher:numFolderColumns="4"
launcher:minAllAppsPredictionColumns="4"
@@ -113,6 +119,7 @@
launcher:minHeightDps="567"
launcher:numRows="5"
launcher:numColumns="4"
+ launcher:numColumnsDrawer="4"
launcher:numFolderRows="4"
launcher:numFolderColumns="4"
launcher:minAllAppsPredictionColumns="4"
@@ -128,6 +135,7 @@
launcher:minHeightDps="694"
launcher:numRows="5"
launcher:numColumns="5"
+ launcher:numColumnsDrawer="5"
launcher:numFolderRows="4"
launcher:numFolderColumns="4"
launcher:minAllAppsPredictionColumns="4"
@@ -143,6 +151,7 @@
launcher:minHeightDps="904"
launcher:numRows="5"
launcher:numColumns="6"
+ launcher:numColumnsDrawer="5"
launcher:numFolderRows="4"
launcher:numFolderColumns="5"
launcher:minAllAppsPredictionColumns="4"
@@ -158,6 +167,7 @@
launcher:minHeightDps="1207"
launcher:numRows="5"
launcher:numColumns="6"
+ launcher:numColumnsDrawer="6"
launcher:numFolderRows="4"
launcher:numFolderColumns="5"
launcher:minAllAppsPredictionColumns="4"
@@ -173,6 +183,7 @@
launcher:minHeightDps="2527"
launcher:numRows="7"
launcher:numColumns="7"
+ launcher:numColumnsDrawer="7"
launcher:numFolderRows="6"
launcher:numFolderColumns="6"
launcher:minAllAppsPredictionColumns="4"
diff --git a/res/xml/launcher_preferences.xml b/res/xml/launcher_preferences.xml
index 7077758b2..2281ab5ad 100644
--- a/res/xml/launcher_preferences.xml
+++ b/res/xml/launcher_preferences.xml
@@ -66,4 +66,9 @@
android:summaryOff="@string/predictive_apps_summary_off"
android:defaultValue="true"
android:persistent="true" />
+
+ <Preference
+ android:key="pref_grid_size"
+ android:title="@string/grid_size_text"
+ android:persistent="true" />
</PreferenceScreen>
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index 69ee03e9e..3ca03a86d 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -444,7 +444,7 @@ public class DeviceProfile {
}
public void updateAppsViewNumCols() {
- allAppsNumCols = allAppsNumPredictiveCols = inv.numColumns;
+ allAppsNumCols = allAppsNumPredictiveCols = inv.numColumnsDrawer;
}
/** Returns the width and height of the search bar, ignoring any padding. */
diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java
index 7a431986d..592f8550a 100644
--- a/src/com/android/launcher3/InvariantDeviceProfile.java
+++ b/src/com/android/launcher3/InvariantDeviceProfile.java
@@ -18,11 +18,13 @@ package com.android.launcher3;
import android.annotation.TargetApi;
import android.content.Context;
+import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
import android.graphics.Point;
import android.util.DisplayMetrics;
+import android.util.Pair;
import android.util.Xml;
import android.view.Display;
import android.view.WindowManager;
@@ -45,6 +47,9 @@ public class InvariantDeviceProfile {
private static final float ICON_SIZE_DEFINED_IN_APP_DP = 48;
+ private static final String KEY_GRID_SIZE = "pref_grid_size";
+ private static final String KEY_GRID_CUSTOM = "pref_grid_custom";
+
// Constants that affects the interpolation curve between statically defined device profile
// buckets.
private static float KNEARESTNEIGHBOR = 3;
@@ -65,6 +70,11 @@ public class InvariantDeviceProfile {
public int numColumns;
/**
+ * Number of icons per row in the drawer
+ */
+ public int numColumnsDrawer;
+
+ /**
* The minimum number of predicted apps in all apps.
*/
@Deprecated
@@ -97,20 +107,22 @@ public class InvariantDeviceProfile {
public InvariantDeviceProfile() {
}
- public InvariantDeviceProfile(InvariantDeviceProfile p) {
- this(p.name, p.minWidthDps, p.minHeightDps, p.numRows, p.numColumns,
+ public InvariantDeviceProfile(Context context, InvariantDeviceProfile p) {
+ this(context, p.name, p.minWidthDps, p.minHeightDps, p.numRows, p.numColumns, p.numColumnsDrawer,
p.numFolderRows, p.numFolderColumns, p.minAllAppsPredictionColumns,
p.iconSize, p.landscapeIconSize, p.iconTextSize, p.numHotseatIcons,
p.defaultLayoutId, p.demoModeLayoutId);
}
- InvariantDeviceProfile(String n, float w, float h, int r, int c, int fr, int fc, int maapc,
- float is, float lis, float its, int hs, int dlId, int dmlId) {
+ InvariantDeviceProfile(Context context, String n, float w, float h, int r, int c, int cd,
+ int fr, int fc, int maapc, float is, float lis, float its, int hs,
+ int dlId, int dmlId) {
name = n;
minWidthDps = w;
minHeightDps = h;
numRows = r;
numColumns = c;
+ numColumnsDrawer = cd;
numFolderRows = fr;
numFolderColumns = fc;
minAllAppsPredictionColumns = maapc;
@@ -120,6 +132,8 @@ public class InvariantDeviceProfile {
numHotseatIcons = hs;
defaultLayoutId = dlId;
demoModeLayoutId = dmlId;
+
+ setGridSize(context);
}
@TargetApi(23)
@@ -140,11 +154,12 @@ public class InvariantDeviceProfile {
ArrayList<InvariantDeviceProfile> closestProfiles = findClosestDeviceProfiles(
minWidthDps, minHeightDps, getPredefinedDeviceProfiles(context));
InvariantDeviceProfile interpolatedDeviceProfileOut =
- invDistWeightedInterpolate(minWidthDps, minHeightDps, closestProfiles);
+ invDistWeightedInterpolate(context, minWidthDps, minHeightDps, closestProfiles);
InvariantDeviceProfile closestProfile = closestProfiles.get(0);
numRows = closestProfile.numRows;
numColumns = closestProfile.numColumns;
+ numColumnsDrawer = closestProfile.numColumnsDrawer;
numHotseatIcons = closestProfile.numHotseatIcons;
defaultLayoutId = closestProfile.defaultLayoutId;
demoModeLayoutId = closestProfile.demoModeLayoutId;
@@ -200,11 +215,13 @@ public class InvariantDeviceProfile {
int numColumns = a.getInt(R.styleable.InvariantDeviceProfile_numColumns, 0);
float iconSize = a.getFloat(R.styleable.InvariantDeviceProfile_iconSize, 0);
profiles.add(new InvariantDeviceProfile(
+ context,
a.getString(R.styleable.InvariantDeviceProfile_name),
a.getFloat(R.styleable.InvariantDeviceProfile_minWidthDps, 0),
a.getFloat(R.styleable.InvariantDeviceProfile_minHeightDps, 0),
numRows,
numColumns,
+ a.getInt(R.styleable.InvariantDeviceProfile_numColumnsDrawer, numColumns),
a.getInt(R.styleable.InvariantDeviceProfile_numFolderRows, numRows),
a.getInt(R.styleable.InvariantDeviceProfile_numFolderColumns, numColumns),
a.getInt(R.styleable.InvariantDeviceProfile_minAllAppsPredictionColumns, numColumns),
@@ -283,7 +300,7 @@ public class InvariantDeviceProfile {
}
// Package private visibility for testing.
- InvariantDeviceProfile invDistWeightedInterpolate(float width, float height,
+ InvariantDeviceProfile invDistWeightedInterpolate(Context context, float width, float height,
ArrayList<InvariantDeviceProfile> points) {
float weights = 0;
@@ -294,7 +311,7 @@ public class InvariantDeviceProfile {
InvariantDeviceProfile out = new InvariantDeviceProfile();
for (int i = 0; i < points.size() && i < KNEARESTNEIGHBOR; ++i) {
- p = new InvariantDeviceProfile(points.get(i));
+ p = new InvariantDeviceProfile(context, points.get(i));
float w = weight(width, height, p.minWidthDps, p.minHeightDps, WEIGHT_POWER);
weights += w;
out.add(p.multiply(w));
@@ -339,6 +356,16 @@ public class InvariantDeviceProfile {
return (float) (WEIGHT_EFFICIENT / Math.pow(d, pow));
}
+ private void setGridSize(Context context) {
+ SharedPreferences prefs = Utilities.getPrefs(context);
+ String defaultGridSize = Utilities.getGridValue(numColumns, numRows);
+ String properSize = prefs.getString(KEY_GRID_SIZE, defaultGridSize);
+
+ Pair<Integer, Integer> values = Utilities.extractCustomGrid(properSize);
+ numColumns = values.first;
+ numRows = values.second;
+ }
+
/**
* As a ratio of screen height, the total distance we want the parallax effect to span
* horizontally
diff --git a/src/com/android/launcher3/SettingsActivity.java b/src/com/android/launcher3/SettingsActivity.java
index 811defe0e..4adac74bd 100644
--- a/src/com/android/launcher3/SettingsActivity.java
+++ b/src/com/android/launcher3/SettingsActivity.java
@@ -27,11 +27,18 @@ import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
+import android.app.AlarmManager;
+import android.app.PendingIntent;
+import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceFragment;
import android.provider.Settings;
+import android.util.Pair;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.NumberPicker;
import com.android.launcher3.graphics.IconShapeOverride;
import com.android.launcher3.notification.NotificationListener;
@@ -49,6 +56,9 @@ public class SettingsActivity extends Activity {
/** Hidden field Settings.Secure.ENABLED_NOTIFICATION_LISTENERS */
private static final String NOTIFICATION_ENABLED_LISTENERS = "enabled_notification_listeners";
+ // Grid size
+ private static final String KEY_GRID_SIZE = "pref_grid_size";
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -64,11 +74,18 @@ public class SettingsActivity extends Activity {
/**
* This fragment shows the launcher preferences.
*/
- public static class LauncherSettingsFragment extends PreferenceFragment {
+ public static class LauncherSettingsFragment extends PreferenceFragment
+ implements SharedPreferences.OnSharedPreferenceChangeListener {
private SystemDisplayRotationLockObserver mRotationLockObserver;
private IconBadgingObserver mIconBadgingObserver;
+ private SharedPreferences mPrefs;
+
+ private Preference mGridPref;
+
+ private boolean mShouldRestart = false;
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -117,6 +134,19 @@ public class SettingsActivity extends Activity {
getPreferenceScreen().removePreference(iconShapeOverride);
}
}
+
+ mGridPref = findPreference(KEY_GRID_SIZE);
+ if (mGridPref != null) {
+ mGridPref.setOnPreferenceClickListener(preference -> {
+ setCustomGridSize();
+ return true;
+ });
+
+ mGridPref.setSummary(mPrefs.getString(KEY_GRID_SIZE, getDefaulGridSize()));
+ }
+
+ mPrefs = Utilities.getPrefs(getActivity().getApplicationContext());
+ mPrefs.registerOnSharedPreferenceChangeListener(this);
}
@Override
@@ -129,8 +159,75 @@ public class SettingsActivity extends Activity {
mIconBadgingObserver.unregister();
mIconBadgingObserver = null;
}
+ mPrefs.unregisterOnSharedPreferenceChangeListener(this);
+
+ if (mShouldRestart) {
+ triggerRestart();
+ }
super.onDestroy();
}
+
+ @Override
+ public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
+ if (KEY_GRID_SIZE.equals(key)) {
+ mGridPref.setSummary(mPrefs.getString(KEY_GRID_SIZE, getDefaulGridSize()));
+ mShouldRestart = true;
+ }
+ }
+
+ private void setCustomGridSize() {
+ int minValue = 3;
+ int maxValue = 9;
+
+ String storedValue = mPrefs.getString(KEY_GRID_SIZE, "4x4");
+ Pair<Integer, Integer> currentValues = Utilities.extractCustomGrid(storedValue);
+
+ LayoutInflater inflater = (LayoutInflater)
+ getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ if (inflater == null) {
+ return;
+ }
+ View contentView = inflater.inflate(R.layout.dialog_custom_grid, null);
+ NumberPicker columnPicker = (NumberPicker)
+ contentView.findViewById(R.id.dialog_grid_column);
+ NumberPicker rowPicker = (NumberPicker)
+ contentView.findViewById(R.id.dialog_grid_row);
+
+ columnPicker.setMinValue(minValue);
+ rowPicker.setMinValue(minValue);
+ columnPicker.setMaxValue(maxValue);
+ rowPicker.setMaxValue(maxValue);
+ columnPicker.setValue(currentValues.first);
+ rowPicker.setValue(currentValues.second);
+
+ new AlertDialog.Builder(getActivity())
+ .setTitle(R.string.grid_size_text)
+ .setMessage(R.string.grid_size_custom_message)
+ .setView(contentView)
+ .setPositiveButton(R.string.grid_size_custom_positive, (dialog, i) -> {
+ String newValues = Utilities.getGridValue(columnPicker.getValue(),
+ rowPicker.getValue());
+ mPrefs.edit().putString(KEY_GRID_SIZE, newValues).apply();
+ })
+ .show();
+ }
+
+ private String getDefaulGridSize() {
+ InvariantDeviceProfile profile = new InvariantDeviceProfile(getActivity());
+ return Utilities.getGridValue(profile.numColumns, profile.numRows);
+ }
+
+ private void triggerRestart() {
+ Context context = getActivity().getApplicationContext();
+ Intent intent = new Intent(Intent.ACTION_MAIN);
+ intent.addCategory(Intent.CATEGORY_HOME);
+ intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ PendingIntent pi = PendingIntent.getActivity(context, 41, intent,
+ PendingIntent.FLAG_CANCEL_CURRENT);
+ AlarmManager manager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
+ manager.set(AlarmManager.RTC, java.lang.System.currentTimeMillis() + 1, pi);
+ java.lang.System.exit(0);
+ }
}
/**
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index b6876f670..d2421f6c4 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -127,6 +127,10 @@ public final class Utilities {
public static final String ALLOW_ROTATION_PREFERENCE_KEY = "pref_allowRotation";
+ private static final String GRID_VALUE_SEPARATOR = "x";
+ private static final int GRID_ROW_VALUE_DEFAULT = 4;
+ private static final int GRID_COLUMN_VALUE_DEFAULT = 5;
+
public static boolean isPropertyEnabled(String propertyName) {
return Log.isLoggable(propertyName, Log.VERBOSE);
}
@@ -655,4 +659,28 @@ public final class Utilities {
return hashSet;
}
+ public static Pair<Integer, Integer> extractCustomGrid(String value) {
+ int columns = GRID_COLUMN_VALUE_DEFAULT;
+ int rows = GRID_ROW_VALUE_DEFAULT;
+ String[] values = value.split(GRID_VALUE_SEPARATOR);
+
+ if (values.length == 2) {
+ try {
+ columns = Integer.parseInt(values[0]);
+ rows = Integer.parseInt(values[1]);
+ } catch (NumberFormatException e) {
+ // Ignore and fallback to default
+ columns = GRID_COLUMN_VALUE_DEFAULT;
+ rows = GRID_ROW_VALUE_DEFAULT;
+ }
+ }
+
+ return new Pair<>(columns, rows);
+
+ }
+
+ public static String getGridValue(int columns, int rows) {
+ return String.format(Locale.ENGLISH, "%1$d%2$s%3$d", columns,
+ GRID_VALUE_SEPARATOR, rows);
+ }
}
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java
index 4eba5c6df..2ba4b8631 100644
--- a/src/com/android/launcher3/allapps/AllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java
@@ -249,10 +249,10 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
// Update the number of items in the grid before we measure the view
grid.updateAppsViewNumCols();
- if (mNumAppsPerRow != grid.inv.numColumns ||
- mNumPredictedAppsPerRow != grid.inv.numColumns) {
- mNumAppsPerRow = grid.inv.numColumns;
- mNumPredictedAppsPerRow = grid.inv.numColumns;
+ if (mNumAppsPerRow != grid.inv.numColumnsDrawer ||
+ mNumPredictedAppsPerRow != grid.inv.numColumnsDrawer) {
+ mNumAppsPerRow = grid.inv.numColumnsDrawer;
+ mNumPredictedAppsPerRow = grid.inv.numColumnsDrawer;
mAppsRecyclerView.setNumAppsPerRow(grid, mNumAppsPerRow);
mAdapter.setNumAppsPerRow(mNumAppsPerRow);