Skip to content
This repository has been archived by the owner on Dec 17, 2023. It is now read-only.

Commit

Permalink
Fix crashes from too little app suggestions for Google search
Browse files Browse the repository at this point in the history
  • Loading branch information
amirzaidi committed Apr 6, 2018
1 parent 24bdea6 commit 8134fd1
Showing 1 changed file with 28 additions and 13 deletions.
41 changes: 28 additions & 13 deletions src/com/google/android/apps/nexuslauncher/qsb/ConfigBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ private void cd() {

private void ce() {
View view = null;
int i2 = 0;
AllAppsRecyclerView appsView = getAppsView();
GridLayoutManager.SpanSizeLookup spanSizeLookup = ((GridLayoutManager) appsView.getLayoutManager())
.getSpanSizeLookup();
Expand Down Expand Up @@ -218,30 +217,46 @@ private void ce() {
}
mBubbleTextView = bubbleTextViewArr[0];
mNano.es = allAppsCols;
int iconCountOffset = 0;
for (int i = 0; i < bubbleTextViewArr.length; i++) {
if (bubbleTextViewArr[i] == null) {
iconCountOffset = allAppsCols - i;
allAppsCols = i;
break;
}
}
co = appsView.getChildViewHolder(bubbleTextViewArr[0]).getItemViewType() == 4;
a_search viewBounds = getViewBounds(bubbleTextViewArr[allAppsCols - 1]);
a_search viewBounds2 = getViewBounds(bubbleTextViewArr[0]);
if (Utilities.isRtl(this.mActivity.getResources())) {
a_search aVar = viewBounds;
viewBounds = viewBounds2;
viewBounds2 = aVar;
a_search lastColumn = getViewBounds(bubbleTextViewArr[allAppsCols - 1]);
a_search firstColumn = getViewBounds(bubbleTextViewArr[0]);
if (Utilities.isRtl(mActivity.getResources())) {
a_search temp = lastColumn;
lastColumn = firstColumn;
firstColumn = temp;
}
int iconWidth = lastColumn.eh;
int totalIconDistance = lastColumn.ef - firstColumn.ef;
int iconDistance = totalIconDistance / allAppsCols;
firstColumn.eh = iconWidth + totalIconDistance;
if (Utilities.isRtl(mActivity.getResources())) {
firstColumn.ef -= iconCountOffset * iconWidth;
firstColumn.eh += iconCountOffset * iconWidth;
} else {
firstColumn.eh += iconCountOffset * (iconDistance + iconWidth);
}
viewBounds2.eh = (viewBounds.eh + viewBounds.ef) - viewBounds2.ef;
mNano.en = viewBounds2;
mNano.en = firstColumn;
if (!this.co) {
viewBounds2.eg -= viewBounds2.ee;
firstColumn.eg -= firstColumn.ee;
} else if (view != null) {
a_search viewBounds3 = getViewBounds(view);
viewBounds3.eh = viewBounds2.eh;
viewBounds3.eh = firstColumn.eh;
mNano.ez = viewBounds3;
}
bW();
List predictedApps = appsView.getApps().getPredictedApps();
int i = Math.min(predictedApps.size(), allAppsCols);
mNano.eo = new b_search[i];
while (i2 < i) {
for (int i2 = 0; i2 < i; i2++) {
mNano.eo[i2] = bZ((AppInfo) predictedApps.get(i2), i2);
i2++;
}
}

Expand Down

0 comments on commit 8134fd1

Please sign in to comment.