diff options
author | nebkat <nebkat@teamhacksung.org> | 2013-01-01 10:51:22 +0000 |
---|---|---|
committer | nebkat <nebkat@teamhacksung.org> | 2013-01-01 10:51:22 +0000 |
commit | f86587daf576f09d0c0864b3555e8175084972ce (patch) | |
tree | 04a840a8d62747ff5007035494371c93ca400ab6 /src | |
parent | 245a6efd8d16359b2706017f70a23413d2a64100 (diff) | |
download | packages_apps_trebuchet-f86587daf576f09d0c0864b3555e8175084972ce.zip packages_apps_trebuchet-f86587daf576f09d0c0864b3555e8175084972ce.tar.gz packages_apps_trebuchet-f86587daf576f09d0c0864b3555e8175084972ce.tar.bz2 |
Cleanup
Change-Id: I92cc54f360032e34e138e2c460d49f24dc028923
Diffstat (limited to 'src')
-rw-r--r-- | src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java | 2 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/Cling.java | 13 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/DeleteDropTarget.java | 16 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/DragController.java | 6 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/DragLayer.java | 45 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/IconCache.java | 4 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/InfoDropTarget.java | 2 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/InstallShortcutReceiver.java | 4 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/LauncherModel.java | 4 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/LauncherProvider.java | 6 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/Workspace.java | 15 |
11 files changed, 32 insertions, 85 deletions
diff --git a/src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java b/src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java index 84c1e44..8e52d41 100644 --- a/src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java +++ b/src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java @@ -667,7 +667,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen } mWidgets.addAll(shortcuts); Collections.sort(mWidgets, - new LauncherModel.WidgetAndShortcutNameComparator(mLauncher, mPackageManager)); + new LauncherModel.WidgetAndShortcutNameComparator(mPackageManager)); updatePageCounts(); invalidateOnDataChange(); } diff --git a/src/com/cyanogenmod/trebuchet/Cling.java b/src/com/cyanogenmod/trebuchet/Cling.java index 510121b..d3abe07 100644 --- a/src/com/cyanogenmod/trebuchet/Cling.java +++ b/src/com/cyanogenmod/trebuchet/Cling.java @@ -33,8 +33,6 @@ import android.view.MotionEvent; import android.view.View; import android.widget.FrameLayout; -import com.cyanogenmod.trebuchet.R; - public class Cling extends FrameLayout { static final String WORKSPACE_CLING_DISMISSED_KEY = "cling.workspace.dismissed"; @@ -139,18 +137,17 @@ public class Cling extends FrameLayout { return new int[]{getMeasuredWidth() / 2, getMeasuredHeight() - (mButtonBarHeight / 2)}; } else if (mDrawIdentifier.equals(WORKSPACE_LANDSCAPE)) { return new int[]{getMeasuredWidth() - (mButtonBarHeight / 2), getMeasuredHeight() / 2}; - } else if (mDrawIdentifier.equals(ALLAPPS_SORT_PORTRAIT) || - mDrawIdentifier.equals(ALLAPPS_SORT_LANDSCAPE) || - mDrawIdentifier.equals(ALLAPPS_SORT_LARGE)) { - return new int[]{mButtonBarHeight / 2, mButtonBarHeight / 2}; } else if (mDrawIdentifier.equals(WORKSPACE_LARGE)) { final float scale = LauncherApplication.getScreenDensity(); final int cornerXOffset = (int) (scale * 15); final int cornerYOffset = (int) (scale * 10); return new int[]{getMeasuredWidth() - cornerXOffset, cornerYOffset}; } else if (mDrawIdentifier.equals(ALLAPPS_PORTRAIT) || - mDrawIdentifier.equals(ALLAPPS_LANDSCAPE) || - mDrawIdentifier.equals(ALLAPPS_LARGE)) { + mDrawIdentifier.equals(ALLAPPS_LANDSCAPE) || + mDrawIdentifier.equals(ALLAPPS_LARGE) || + mDrawIdentifier.equals(ALLAPPS_SORT_PORTRAIT) || + mDrawIdentifier.equals(ALLAPPS_SORT_LANDSCAPE) || + mDrawIdentifier.equals(ALLAPPS_SORT_LARGE)) { return mPositionData; } return new int[]{-1, -1}; diff --git a/src/com/cyanogenmod/trebuchet/DeleteDropTarget.java b/src/com/cyanogenmod/trebuchet/DeleteDropTarget.java index 4ab8ddd..d98fd62 100644 --- a/src/com/cyanogenmod/trebuchet/DeleteDropTarget.java +++ b/src/com/cyanogenmod/trebuchet/DeleteDropTarget.java @@ -39,11 +39,11 @@ import android.view.animation.DecelerateInterpolator; import android.view.animation.LinearInterpolator; public class DeleteDropTarget extends ButtonDropTarget { - private static int DELETE_ANIMATION_DURATION = 285; - private static int FLING_DELETE_ANIMATION_DURATION = 350; - private static float FLING_TO_DELETE_FRICTION = 0.035f; - private static int MODE_FLING_DELETE_TO_TRASH = 0; - private static int MODE_FLING_DELETE_ALONG_VECTOR = 1; + private static final int DELETE_ANIMATION_DURATION = 285; + private static final int FLING_DELETE_ANIMATION_DURATION = 350; + private static final float FLING_TO_DELETE_FRICTION = 0.035f; + private static final int MODE_FLING_DELETE_TO_TRASH = 0; + private static final int MODE_FLING_DELETE_ALONG_VECTOR = 1; private final int mFlingDeleteMode = MODE_FLING_DELETE_ALONG_VECTOR; @@ -430,8 +430,7 @@ public class DeleteDropTarget extends ButtonDropTarget { } } private AnimatorUpdateListener createFlingAlongVectorAnimatorListener(final DragLayer dragLayer, - DragObject d, PointF vel, final long startTime, final int duration, - ViewConfiguration config) { + DragObject d, PointF vel, final long startTime) { final Rect from = new Rect(); dragLayer.getViewRectRelativeToSelf(d.dragView, from); @@ -486,8 +485,7 @@ public class DeleteDropTarget extends ButtonDropTarget { if (mFlingDeleteMode == MODE_FLING_DELETE_TO_TRASH) { updateCb = createFlingToTrashAnimatorListener(dragLayer, d, vel, config); } else if (mFlingDeleteMode == MODE_FLING_DELETE_ALONG_VECTOR) { - updateCb = createFlingAlongVectorAnimatorListener(dragLayer, d, vel, startTime, - duration, config); + updateCb = createFlingAlongVectorAnimatorListener(dragLayer, d, vel, startTime); } Runnable onAnimationEndRunnable = new Runnable() { @Override diff --git a/src/com/cyanogenmod/trebuchet/DragController.java b/src/com/cyanogenmod/trebuchet/DragController.java index 7e0dcdb..2a05695 100644 --- a/src/com/cyanogenmod/trebuchet/DragController.java +++ b/src/com/cyanogenmod/trebuchet/DragController.java @@ -440,7 +440,7 @@ public class DragController { if (mDragging) { PointF vec = isFlingingToDelete(mDragObject.dragSource); if (vec != null) { - dropOnFlingToDeleteTarget(dragLayerX, dragLayerY, vec); + dropOnFlingToDeleteTarget(vec); } else { drop(dragLayerX, dragLayerY); } @@ -582,7 +582,7 @@ public class DragController { if (mDragging) { PointF vec = isFlingingToDelete(mDragObject.dragSource); if (vec != null) { - dropOnFlingToDeleteTarget(dragLayerX, dragLayerY, vec); + dropOnFlingToDeleteTarget(vec); } else { drop(dragLayerX, dragLayerY); } @@ -624,7 +624,7 @@ public class DragController { return null; } - private void dropOnFlingToDeleteTarget(float x, float y, PointF vel) { + private void dropOnFlingToDeleteTarget(PointF vel) { final int[] coordinates = mCoordinatesTemp; mDragObject.x = coordinates[0]; diff --git a/src/com/cyanogenmod/trebuchet/DragLayer.java b/src/com/cyanogenmod/trebuchet/DragLayer.java index f7f46ac..eb7a5d1 100644 --- a/src/com/cyanogenmod/trebuchet/DragLayer.java +++ b/src/com/cyanogenmod/trebuchet/DragLayer.java @@ -27,11 +27,9 @@ import android.graphics.Canvas; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.util.AttributeSet; -import android.util.Log; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; -import android.view.ViewGroup; import android.view.ViewParent; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; @@ -40,15 +38,12 @@ import android.view.animation.Interpolator; import android.widget.FrameLayout; import android.widget.TextView; -import com.cyanogenmod.trebuchet.R; - import java.util.ArrayList; -import java.util.Arrays; /** * A ViewGroup that coordinates dragging across its descendants */ -public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChangeListener { +public class DragLayer extends FrameLayout { private DragController mDragController; private int[] mTmpXY = new int[2]; @@ -70,8 +65,6 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang private boolean mHoverPointClosesFolder = false; private Rect mHitRect = new Rect(); - private int mWorkspaceIndex = -1; - private int mQsbIndex = -1; public static final int ANIMATION_END_DISAPPEAR = 0; public static final int ANIMATION_END_FADE_OUT = 1; public static final int ANIMATION_END_REMAIN_VISIBLE = 2; @@ -88,7 +81,6 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang // Disable multitouch across the workspace/all apps/customize tray setMotionEventSplittingEnabled(false); setChildrenDrawingOrderEnabled(true); - setOnHierarchyChangeListener(this); mLeftHoverDrawable = getResources().getDrawable(R.drawable.page_hover_left_holo); mRightHoverDrawable = getResources().getDrawable(R.drawable.page_hover_right_holo); @@ -182,10 +174,8 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang sendTapOutsideFolderAccessibilityEvent(currentFolder.isEditingName()); mHoverPointClosesFolder = true; return true; - } else if (isOverFolder) { - mHoverPointClosesFolder = false; } else { - return true; + mHoverPointClosesFolder = false; } case MotionEvent.ACTION_HOVER_MOVE: isOverFolder = isEventOverFolder(currentFolder, ev); @@ -253,8 +243,7 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang mCurrentResizeFrame = null; } } - if (handled) return true; - return mDragController.onTouchEvent(ev); + return handled || mDragController.onTouchEvent(ev); } /** @@ -399,16 +388,7 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang } } - public boolean hasResizeFrames() { - return mResizeFrames.size() > 0; - } - - public boolean isWidgetBeingResized() { - return mCurrentResizeFrame != null; - } - - public void addResizeFrame(ItemInfo itemInfo, LauncherAppWidgetHostView widget, - CellLayout cellLayout) { + public void addResizeFrame(LauncherAppWidgetHostView widget, CellLayout cellLayout) { AppWidgetResizeFrame resizeFrame = new AppWidgetResizeFrame(getContext(), widget, cellLayout, this); @@ -685,23 +665,6 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang mFadeOutAnim.start(); } - @Override - public void onChildViewAdded(View parent, View child) { - updateChildIndices(); - } - - @Override - public void onChildViewRemoved(View parent, View child) { - updateChildIndices(); - } - - private void updateChildIndices() { - if (mLauncher != null) { - mWorkspaceIndex = indexOfChild(mLauncher.getWorkspace()); - mQsbIndex = indexOfChild(mLauncher.getSearchBar()); - } - } - private boolean mInScrollArea; private Drawable mLeftHoverDrawable; private Drawable mRightHoverDrawable; diff --git a/src/com/cyanogenmod/trebuchet/IconCache.java b/src/com/cyanogenmod/trebuchet/IconCache.java index 079e091..7005e12 100644 --- a/src/com/cyanogenmod/trebuchet/IconCache.java +++ b/src/com/cyanogenmod/trebuchet/IconCache.java @@ -216,9 +216,9 @@ public class IconCache { return entry; } - public HashMap<ComponentName,Bitmap> getAllIcons() { + public HashMap<ComponentName, Bitmap> getAllIcons() { synchronized (mCache) { - HashMap<ComponentName,Bitmap> set = new HashMap<ComponentName,Bitmap>(); + HashMap<ComponentName, Bitmap> set = new HashMap<ComponentName,Bitmap>(); for (ComponentName cn : mCache.keySet()) { final CacheEntry e = mCache.get(cn); set.put(cn, e.icon); diff --git a/src/com/cyanogenmod/trebuchet/InfoDropTarget.java b/src/com/cyanogenmod/trebuchet/InfoDropTarget.java index c24bf8b..941a294 100644 --- a/src/com/cyanogenmod/trebuchet/InfoDropTarget.java +++ b/src/com/cyanogenmod/trebuchet/InfoDropTarget.java @@ -26,8 +26,6 @@ import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; -import com.cyanogenmod.trebuchet.R; - public class InfoDropTarget extends ButtonDropTarget { private ColorStateList mOriginalTextColor; diff --git a/src/com/cyanogenmod/trebuchet/InstallShortcutReceiver.java b/src/com/cyanogenmod/trebuchet/InstallShortcutReceiver.java index fd11fa0..1d68654 100644 --- a/src/com/cyanogenmod/trebuchet/InstallShortcutReceiver.java +++ b/src/com/cyanogenmod/trebuchet/InstallShortcutReceiver.java @@ -143,7 +143,7 @@ public class InstallShortcutReceiver extends BroadcastReceiver { for (int i = 0; i <= (2 * screenCount) + 1 && !found; ++i) { int si = screen + (int) ((i / 2f) + 0.5f) * ((i % 2 == 1) ? 1 : -1); if (0 <= si && si < screenCount) { - found = installShortcut(context, data, items, name, intent, si, exists, sp, + found = installShortcut(context, data, items, intent, si, exists, sp, result); } } @@ -163,7 +163,7 @@ public class InstallShortcutReceiver extends BroadcastReceiver { } private static boolean installShortcut(Context context, Intent data, ArrayList<ItemInfo> items, - String name, Intent intent, final int screen, boolean shortcutExists, + Intent intent, final int screen, boolean shortcutExists, final SharedPreferences sharedPrefs, int[] result) { int[] tmpCoordinates = new int[2]; if (findEmptyCell(items, tmpCoordinates, screen)) { diff --git a/src/com/cyanogenmod/trebuchet/LauncherModel.java b/src/com/cyanogenmod/trebuchet/LauncherModel.java index 13f2250..12fdb45 100644 --- a/src/com/cyanogenmod/trebuchet/LauncherModel.java +++ b/src/com/cyanogenmod/trebuchet/LauncherModel.java @@ -2428,11 +2428,9 @@ public class LauncherModel extends BroadcastReceiver { } public static class WidgetAndShortcutNameComparator implements Comparator<Object> { private Collator mCollator; - private Context mContext; private PackageManager mPackageManager; private HashMap<Object, String> mLabelCache; - WidgetAndShortcutNameComparator(Context context, PackageManager pm) { - mContext = context; + WidgetAndShortcutNameComparator(PackageManager pm) { mPackageManager = pm; mLabelCache = new HashMap<Object, String>(); mCollator = Collator.getInstance(); diff --git a/src/com/cyanogenmod/trebuchet/LauncherProvider.java b/src/com/cyanogenmod/trebuchet/LauncherProvider.java index c7649b7..b16002a 100644 --- a/src/com/cyanogenmod/trebuchet/LauncherProvider.java +++ b/src/com/cyanogenmod/trebuchet/LauncherProvider.java @@ -28,7 +28,6 @@ import android.content.ContentValues; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; -import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; import android.content.res.Resources; import android.content.res.TypedArray; @@ -628,7 +627,7 @@ public class LauncherProvider extends ContentProvider { } else if (TAG_APPWIDGET.equals(name)) { added = addAppWidget(parser, attrs, db, values, a, packageManager); } else if (TAG_ALLAPPS.equals(name)) { - long id = addAllAppsButton(db, values, a); + long id = addAllAppsButton(db, values); added = id >= 0; } else if (TAG_SHORTCUT.equals(name)) { long id = addUriShortcut(db, values, a); @@ -883,8 +882,7 @@ public class LauncherProvider extends ContentProvider { return allocatedAppWidgets; } - private long addAllAppsButton(SQLiteDatabase db, ContentValues values, - TypedArray a) { + private long addAllAppsButton(SQLiteDatabase db, ContentValues values) { Resources r = mContext.getResources(); long id = generateNewId(); diff --git a/src/com/cyanogenmod/trebuchet/Workspace.java b/src/com/cyanogenmod/trebuchet/Workspace.java index 558a9e8..ac327f8 100644 --- a/src/com/cyanogenmod/trebuchet/Workspace.java +++ b/src/com/cyanogenmod/trebuchet/Workspace.java @@ -1099,8 +1099,8 @@ public class Workspace extends PagedView } private void updateWallpaperOffsets() { - boolean updateNow = false; - boolean keepUpdating = true; + boolean updateNow; + boolean keepUpdating; if (mUpdateWallpaperOffsetImmediately) { updateNow = true; keepUpdating = false; @@ -2915,7 +2915,7 @@ public class Workspace extends PagedView final Runnable addResizeFrame = new Runnable() { public void run() { DragLayer dragLayer = mLauncher.getDragLayer(); - dragLayer.addResizeFrame(info, hostView, cellLayout); + dragLayer.addResizeFrame(hostView, cellLayout); } }; resizeRunnable = (new Runnable() { @@ -3105,10 +3105,6 @@ public class Workspace extends PagedView setCurrentDropOverCell(-1, -1); } - PagedView getCurrentDropTarget() { - return mLauncher.isHotseatLayout(mDragTargetLayout) ? mLauncher.getHotseat() : this; - } - void setCurrentDragOverlappingLayout(CellLayout layout) { if (mDragOverlappingLayout != null) { mDragOverlappingLayout.setIsDragOverlapping(false); @@ -3788,7 +3784,7 @@ public class Workspace extends PagedView private void getFinalPositionForDropAnimation(int[] loc, float[] scaleXY, DragView dragView, CellLayout layout, ItemInfo info, int[] targetCell, - boolean external, boolean scale) { + boolean scale) { // Now we animate the dragView, (ie. the widget or shortcut preview) into its final // location and size on the home screen. int spanX = info.spanX; @@ -3832,7 +3828,7 @@ public class Workspace extends PagedView float scaleXY[] = new float[2]; boolean scalePreview = !(info instanceof PendingAddShortcutInfo); getFinalPositionForDropAnimation(finalPos, scaleXY, dragView, cellLayout, info, mTargetCell, - external, scalePreview); + scalePreview); Resources res = mLauncher.getResources(); int duration = res.getInteger(R.integer.config_dropAnimMaxDuration) - 200; @@ -4253,7 +4249,6 @@ public class Workspace extends PagedView } else if (tag instanceof FolderInfo) { final FolderInfo info = (FolderInfo) tag; final ArrayList<ShortcutInfo> contents = info.contents; - final int contentsCount = contents.size(); final ArrayList<ShortcutInfo> appsToRemoveFromFolder = new ArrayList<ShortcutInfo>(); |