Fix warnings and remove dead code

Change-Id: I574d823fedf4b752c3df5a72599b390f708823ac
This commit is contained in:
Michael Jurka
2012-04-13 14:44:29 -07:00
parent 8c198fb862
commit 3a9fcedbcd
25 changed files with 41 additions and 94 deletions
@@ -16,8 +16,6 @@ import android.widget.ImageView;
import com.android.launcher.R;
public class AppWidgetResizeFrame extends FrameLayout {
private ItemInfo mItemInfo;
private LauncherAppWidgetHostView mWidgetView;
private CellLayout mCellLayout;
private DragLayer mDragLayer;
@@ -69,12 +67,11 @@ public class AppWidgetResizeFrame extends FrameLayout {
private Launcher mLauncher;
public AppWidgetResizeFrame(Context context, ItemInfo itemInfo,
public AppWidgetResizeFrame(Context context,
LauncherAppWidgetHostView widgetView, CellLayout cellLayout, DragLayer dragLayer) {
super(context);
mLauncher = (Launcher) context;
mItemInfo = itemInfo;
mCellLayout = cellLayout;
mWidgetView = widgetView;
mResizeMode = widgetView.getAppWidgetInfo().resizeMode;
@@ -1214,8 +1214,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
// Determine the widget spans and min resize spans.
int[] spanXY = mLauncher.getSpanForWidget(info);
int[] size = mLauncher.getWorkspace().estimateItemSize(spanXY[0],
spanXY[1], createItemInfo, true);
createItemInfo.spanX = spanXY[0];
createItemInfo.spanY = spanXY[1];
int[] minSpanXY = mLauncher.getMinSpanForWidget(info);
@@ -20,8 +20,6 @@ import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.Region;
import android.graphics.Region.Op;
@@ -30,8 +28,6 @@ import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.TextView;
import com.android.launcher.R;
/**
* TextView that draws a bubble behind the text. We cannot use a LineBackgroundSpan
* because we want to make the bubble taller than the text and TextView's clip is
@@ -85,7 +81,6 @@ public class BubbleTextView extends TextView {
mBackground = getBackground();
final Resources res = getContext().getResources();
int bubbleColor = res.getColor(R.color.bubble_dark_background);
mFocusedOutlineColor = mFocusedGlowColor = mPressedOutlineColor = mPressedGlowColor =
res.getColor(android.R.color.holo_blue_light);
+3 -1
View File
@@ -268,7 +268,9 @@ public class CellLayout extends ViewGroup {
// If an animation is started and then stopped very quickly, we can still
// get spurious updates we've cleared the tag. Guard against this.
if (outline == null) {
if (false) {
@SuppressWarnings("all") // suppress dead code warning
final boolean debug = false;
if (debug) {
Object val = animation.getAnimatedValue();
Log.d(TAG, "anim " + thisIndex + " update: " + val +
", isStopped " + anim.isStopped());
@@ -40,7 +40,6 @@ import java.util.ArrayList;
* Class for initiating a drag within a view or across multiple views.
*/
public class DragController {
@SuppressWarnings({"UnusedDeclaration"})
private static final String TAG = "Launcher.DragController";
/** Indicates the drag is a move. */
@@ -347,7 +346,6 @@ public class DragController {
* || super.dispatchKeyEvent(event);
* </pre>
*/
@SuppressWarnings({"UnusedDeclaration"})
public boolean dispatchKeyEvent(KeyEvent event) {
return mDragging;
}
@@ -457,7 +455,9 @@ public class DragController {
* Call this from a drag source view.
*/
public boolean onInterceptTouchEvent(MotionEvent ev) {
if (false) {
@SuppressWarnings("all") // suppress dead code warning
final boolean debug = false;
if (debug) {
Log.d(Launcher.TAG, "DragController.onInterceptTouchEvent " + ev + " mDragging="
+ mDragging);
}
+1 -5
View File
@@ -23,9 +23,6 @@ import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PointF;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.KeyEvent;
@@ -34,7 +31,6 @@ import android.view.View;
import android.view.ViewParent;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import android.view.animation.AnimationUtils;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
import android.widget.FrameLayout;
@@ -402,7 +398,7 @@ public class DragLayer extends FrameLayout {
public void addResizeFrame(ItemInfo itemInfo, LauncherAppWidgetHostView widget,
CellLayout cellLayout) {
AppWidgetResizeFrame resizeFrame = new AppWidgetResizeFrame(getContext(),
itemInfo, widget, cellLayout, this);
widget, cellLayout, this);
LayoutParams lp = new LayoutParams(-1, -1);
lp.customPosition = true;
+3 -2
View File
@@ -167,8 +167,9 @@ public class DragView extends View {
@Override
protected void onDraw(Canvas canvas) {
if (false) {
// for debugging
@SuppressWarnings("all") // suppress dead code warning
final boolean debug = false;
if (debug) {
Paint p = new Paint();
p.setStyle(Paint.Style.FILL);
p.setColor(0x66ffffff);
@@ -18,12 +18,8 @@ package com.android.launcher2;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import com.android.launcher.R;
@@ -626,7 +626,6 @@ public class FocusHelper {
int lineDelta) {
final ArrayList<View> views = getCellLayoutChildrenSortedSpatially(layout, parent);
final CellLayout.LayoutParams lp = (CellLayout.LayoutParams) v.getLayoutParams();
final int cellCountX = layout.getCountX();
final int cellCountY = layout.getCountY();
final int row = lp.cellY;
final int newRow = row + lineDelta;
+1 -1
View File
@@ -44,7 +44,6 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import com.android.launcher.R;
import com.android.launcher2.DropTarget.DragObject;
import com.android.launcher2.FolderInfo.FolderListener;
import java.util.ArrayList;
@@ -56,6 +55,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
View.OnLongClickListener, DropTarget, FolderListener, TextView.OnEditorActionListener,
View.OnFocusChangeListener {
@SuppressWarnings("unused")
private static final String TAG = "Launcher.Folder";
protected DragController mDragController;
+3 -2
View File
@@ -119,8 +119,9 @@ public class FolderIcon extends LinearLayout implements FolderListener {
static FolderIcon fromXml(int resId, Launcher launcher, ViewGroup group,
FolderInfo folderInfo, IconCache iconCache) {
if (INITIAL_ITEM_ANIMATION_DURATION >= DROP_IN_ANIMATION_DURATION) {
@SuppressWarnings("all") // suppress dead code warning
final boolean error = INITIAL_ITEM_ANIMATION_DURATION >= DROP_IN_ANIMATION_DURATION;
if (error) {
throw new IllegalStateException("DROP_IN_ANIMATION_DURATION must be greater than " +
"INITIAL_ITEM_ANIMATION_DURATION, as sequencing of adding first two items " +
"is dependent on this");
+1
View File
@@ -28,6 +28,7 @@ import android.widget.FrameLayout;
import com.android.launcher.R;
public class Hotseat extends FrameLayout {
@SuppressWarnings("unused")
private static final String TAG = "Hotseat";
private Launcher mLauncher;
+1
View File
@@ -33,6 +33,7 @@ import java.util.HashMap;
* Cache of application icons. Icons can be made from any thread.
*/
public class IconCache {
@SuppressWarnings("unused")
private static final String TAG = "Launcher.IconCache";
private static final int INITIAL_ICON_CACHE_CAPACITY = 50;
+1 -10
View File
@@ -1528,7 +1528,6 @@ public final class Launcher extends Activity
void addAppWidgetImpl(final int appWidgetId, final PendingAddWidgetInfo info) {
final AppWidgetProviderInfo appWidget = info.info;
Runnable configurationActivity = null;
if (appWidget.configure != null) {
// Launch over to configure widget, if needed
Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_CONFIGURE);
@@ -2155,14 +2154,6 @@ public final class Launcher extends Activity
showDialog(DIALOG_RENAME_FOLDER);
}
private void showAddDialog() {
resetAddInfo();
mPendingAddInfo.container = LauncherSettings.Favorites.CONTAINER_DESKTOP;
mPendingAddInfo.screen = mWorkspace.getCurrentPage();
mWaitingForResult = true;
showDialog(DIALOG_CREATE_SHORTCUT);
}
private class RenameFolder {
private EditText mInput;
@@ -2470,7 +2461,7 @@ public final class Launcher extends Activity
}
}
});
observer.removeGlobalOnLayoutListener(this);
observer.removeOnGlobalLayoutListener(this);
}
};
observer.addOnGlobalLayoutListener(delayedStart);
@@ -21,7 +21,6 @@ import android.content.Context;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import com.android.launcher.R;
@@ -25,7 +25,6 @@ import android.content.IntentFilter;
import android.content.res.Configuration;
import android.database.ContentObserver;
import android.os.Handler;
import android.view.MotionEvent;
import com.android.launcher.R;
+6 -4
View File
@@ -1035,9 +1035,9 @@ public class LauncherModel extends BroadcastReceiver {
(LauncherSettings.Favorites.SPANX);
final int spanYIndex = c.getColumnIndexOrThrow(
LauncherSettings.Favorites.SPANY);
final int uriIndex = c.getColumnIndexOrThrow(LauncherSettings.Favorites.URI);
final int displayModeIndex = c.getColumnIndexOrThrow(
LauncherSettings.Favorites.DISPLAY_MODE);
//final int uriIndex = c.getColumnIndexOrThrow(LauncherSettings.Favorites.URI);
//final int displayModeIndex = c.getColumnIndexOrThrow(
// LauncherSettings.Favorites.DISPLAY_MODE);
ShortcutInfo info;
String intentDescription;
@@ -1825,7 +1825,9 @@ public class LauncherModel extends BroadcastReceiver {
}
Bitmap getIconFromCursor(Cursor c, int iconIndex, Context context) {
if (false) {
@SuppressWarnings("all") // suppress dead code warning
final boolean debug = false;
if (debug) {
Log.d(TAG, "getIconFromCursor app="
+ c.getString(c.getColumnIndexOrThrow(LauncherSettings.Favorites.TITLE)));
}
@@ -31,6 +31,7 @@ public class PagedViewIcon extends TextView {
void iconPressed(PagedViewIcon icon);
}
@SuppressWarnings("unused")
private static final String TAG = "PagedViewIcon";
private static final float PRESS_ALPHA = 0.4f;
@@ -332,7 +332,7 @@ public class RocketLauncher extends BasicDream {
protected void onAttachedToWindow() {
super.onAttachedToWindow();
setLayerType(View.LAYER_TYPE_HARDWARE, null);
setSystemUiVisibility(View.STATUS_BAR_HIDDEN);
setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
reset();
mAnim.start();
@@ -246,7 +246,7 @@ public class SearchDropTargetBar extends FrameLayout implements DragController.D
mQSBSearchBar.setBackgroundResource(0);
} else if (mPreviousBackground != null && (searchVisible || voiceVisible)) {
// Restore the background
mQSBSearchBar.setBackgroundDrawable(mPreviousBackground);
mQSBSearchBar.setBackground(mPreviousBackground);
}
}
}
@@ -24,8 +24,6 @@ import android.graphics.Rect;
import android.view.View;
import android.view.ViewGroup;
import com.android.launcher2.CellLayout.LayoutParams;
public class ShortcutAndWidgetContainer extends ViewGroup {
static final String TAG = "CellLayoutChildren";
@@ -73,8 +71,10 @@ public class ShortcutAndWidgetContainer extends ViewGroup {
@Override
protected void dispatchDraw(Canvas canvas) {
// Debug drawing for hit space
if (false) {
@SuppressWarnings("all") // suppress dead code warning
final boolean debug = false;
if (debug) {
// Debug drawing for hit space
Paint p = new Paint();
p.setColor(0x6600FF00);
for (int i = getChildCount() - 1; i >= 0; i--) {
+8 -3
View File
@@ -41,6 +41,7 @@ import com.android.launcher.R;
* Various utilities shared amongst the Launcher's classes.
*/
final class Utilities {
@SuppressWarnings("unused")
private static final String TAG = "Launcher.Utilities";
private static int sIconWidth = -1;
@@ -83,7 +84,8 @@ final class Utilities {
return icon;
} else {
// Icon is too small, render to a larger bitmap
return createIconBitmap(new BitmapDrawable(icon), context);
final Resources resources = context.getResources();
return createIconBitmap(new BitmapDrawable(resources, icon), context);
}
}
@@ -142,7 +144,9 @@ final class Utilities {
final int left = (textureWidth-width) / 2;
final int top = (textureHeight-height) / 2;
if (false) {
@SuppressWarnings("all") // suppress dead code warning
final boolean debug = false;
if (debug) {
// draw a big box for the icon for debugging
canvas.drawColor(sColors[sColorIndex]);
if (++sColorIndex >= sColors.length) sColorIndex = 0;
@@ -205,7 +209,8 @@ final class Utilities {
if (bitmap.getWidth() == sIconWidth && bitmap.getHeight() == sIconHeight) {
return bitmap;
} else {
return createIconBitmap(new BitmapDrawable(bitmap), context);
final Resources resources = context.getResources();
return createIconBitmap(new BitmapDrawable(resources, bitmap), context);
}
}
}
@@ -24,6 +24,7 @@ import android.app.Fragment;
import android.os.Bundle;
public class WallpaperChooser extends Activity {
@SuppressWarnings("unused")
private static final String TAG = "Launcher.WallpaperChooser";
@Override
@@ -137,7 +137,7 @@ public class WallpaperChooserDialogFragment extends DialogFragment implements
*/
if (mEmbedded) {
View view = inflater.inflate(R.layout.wallpaper_chooser, container, false);
view.setBackgroundDrawable(mWallpaperDrawable);
view.setBackground(mWallpaperDrawable);
final Gallery gallery = (Gallery) view.findViewById(R.id.gallery);
gallery.setCallbackDuringFling(false);
-38
View File
@@ -26,7 +26,6 @@ import android.app.WallpaperManager;
import android.appwidget.AppWidgetHostView;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProviderInfo;
import android.content.ClipDescription;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -35,40 +34,32 @@ import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Camera;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.Region.Op;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.IBinder;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.Pair;
import android.view.Display;
import android.view.DragEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.widget.ImageView;
import android.widget.TextView;
import com.android.launcher.R;
import com.android.launcher2.DropTarget.DragObject;
import com.android.launcher2.FolderIcon.FolderRingAnimator;
import com.android.launcher2.InstallWidgetReceiver.WidgetMimeTypeHandlerData;
import com.android.launcher2.LauncherSettings.Favorites;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
/**
* The workspace is a wide area with a wallpaper and a finite number of pages.
@@ -78,7 +69,6 @@ import java.util.List;
public class Workspace extends SmoothPagedView
implements DropTarget, DragSource, DragScroller, View.OnTouchListener,
DragController.DragListener, LauncherTransitionable {
@SuppressWarnings({"UnusedDeclaration"})
private static final String TAG = "Launcher.Workspace";
// Y rotation to apply to the workspace screens
@@ -144,8 +134,6 @@ public class Workspace extends SmoothPagedView
*/
private CellLayout mDropToLayout = null;
private boolean mDragHasEnteredWorkspace = false;
private Launcher mLauncher;
private IconCache mIconCache;
private DragController mDragController;
@@ -2408,7 +2396,6 @@ public class Workspace extends SmoothPagedView
public void onDragEnter(DragObject d) {
mDragEnforcer.onDragEnter();
mDragHasEnteredWorkspace = true;
mCreateUserFolderOnDrop = false;
mAddToExistingFolderOnDrop = false;
@@ -2426,7 +2413,6 @@ public class Workspace extends SmoothPagedView
public void onDragExit(DragObject d) {
mDragEnforcer.onDragExit();
mDragHasEnteredWorkspace = false;
// Here we store the final page that will be dropped to, if the workspace in fact
// receives the drop
@@ -2536,30 +2522,6 @@ public class Workspace extends SmoothPagedView
return null;
}
/**
* Tests to see if the drop will be accepted by Launcher, and if so, includes additional data
* in the returned structure related to the widgets that match the drop (or a null list if it is
* a shortcut drop). If the drop is not accepted then a null structure is returned.
*/
private Pair<Integer, List<WidgetMimeTypeHandlerData>> validateDrag(DragEvent event) {
final LauncherModel model = mLauncher.getModel();
final ClipDescription desc = event.getClipDescription();
final int mimeTypeCount = desc.getMimeTypeCount();
for (int i = 0; i < mimeTypeCount; ++i) {
final String mimeType = desc.getMimeType(i);
if (mimeType.equals(InstallShortcutReceiver.SHORTCUT_MIMETYPE)) {
return new Pair<Integer, List<WidgetMimeTypeHandlerData>>(i, null);
} else {
final List<WidgetMimeTypeHandlerData> widgets =
model.resolveWidgetsForMimeType(mContext, mimeType);
if (widgets.size() > 0) {
return new Pair<Integer, List<WidgetMimeTypeHandlerData>>(i, widgets);
}
}
}
return null;
}
/*
*
* Convert the 2D coordinate xy from the parent View's coordinate space to this CellLayout's