Merge "Fix NPE" into ics-mr1

This commit is contained in:
Michael Jurka
2011-10-30 19:41:14 -07:00
committed by Android (Google) Code Review
2 changed files with 7 additions and 4 deletions
+7 -3
View File
@@ -2582,21 +2582,25 @@ public final class Launcher extends Activity
// if successful in getting icon, return it; otherwise, set button to use default drawable
private Drawable.ConstantState updateTextButtonWithIconFromExternalActivity(
int buttonId, ComponentName activityName, int fallbackDrawableId) {
TextView button = (TextView) findViewById(buttonId);
Drawable toolbarIcon = getExternalPackageToolbarIcon(activityName);
Resources r = getResources();
int w = r.getDimensionPixelSize(R.dimen.toolbar_external_icon_width);
int h = r.getDimensionPixelSize(R.dimen.toolbar_external_icon_height);
TextView button = (TextView) findViewById(buttonId);
// If we were unable to find the icon via the meta-data, use a generic one
if (toolbarIcon == null) {
toolbarIcon = r.getDrawable(fallbackDrawableId);
toolbarIcon.setBounds(0, 0, w, h);
button.setCompoundDrawables(toolbarIcon, null, null, null);
if (button != null) {
button.setCompoundDrawables(toolbarIcon, null, null, null);
}
return null;
} else {
toolbarIcon.setBounds(0, 0, w, h);
button.setCompoundDrawables(toolbarIcon, null, null, null);
if (button != null) {
button.setCompoundDrawables(toolbarIcon, null, null, null);
}
return toolbarIcon.getConstantState();
}
}
-1
View File
@@ -713,7 +713,6 @@ public abstract class PagedView extends ViewGroup {
rightScreen++;
x += getScaledMeasuredWidth(getPageAt(rightScreen)) + mPageSpacing;
}
rightScreen = Math.min(getChildCount() - 1, rightScreen);
final long drawingTime = getDrawingTime();
// Clip to the bounds